-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use sdk-java in android. #177
Comments
Just wanted to comment here and say I've run into this too. Longer explanation. I thought of compiling the jar file from sdk-java and including that in android.
Welp, I finally got it compiled. But it still doesn't work. I'll post my pom.xml file, in case you want to try it out. <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>net.authorize</groupId>
<artifactId>anet-java-sdk</artifactId>
<packaging>jar</packaging>
<version>2.0.3-SNAPSHOT</version>
<name>Authorize.Net Java SDK</name>
<description>Authorize.Net SDK includes standard payments, recurring billing, and customer profiles.</description>
<url>http://developer.authorize.net</url>
<licenses>
<license>
<name>SDK License Agreement</name>
<url>https://github.com/AuthorizeNet/sdk-java/blob/master/LICENSE.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>scm:git:https://github.com/AuthorizeNet/sdk-java.git</connection>
<developerConnection>scm:git:https://github.com/AuthorizeNet/sdk-java.git</developerConnection>
<url>https://github.com/AuthorizeNet/sdk-java.git</url>
</scm>
<developers>
<developer>
<id>authorizenet</id>
<name>Authorize.Net Developer</name>
<email>[email protected]</email>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.6</version>
<scope>compile</scope>
</dependency>
<!-- Log4j Dependencies -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId>
<version>2.13.3</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.13.3</version>
</dependency>
<!-- Log4j Dependencies -->
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock</artifactId>
<version>2.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compile.source>1.5</maven.compile.source>
<maven.compile.target>1.5</maven.compile.target>
<maven.compile.optimize>true</maven.compile.optimize>
<maven.compile.deprecation>true</maven.compile.deprecation>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<!-- <executions> <execution> <phase>initialize</phase> <goals> <goal>read-project-properties</goal>
</goals> <configuration> <files> <file>${user.home}/anet-java-sdk.properties</file>
</files> </configuration> </execution> </executions> -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.9</version>
<configuration>
<includes>
<include> **/mocktest/**.java</include>
</includes>
<skipTests>false</skipTests>
<forkCount>1</forkCount>
<systemPropertyVariables>
<API_LOGIN_ID>${api.login.id}</API_LOGIN_ID>
<TRANSACTION_KEY>${transaction.key}</TRANSACTION_KEY>
</systemPropertyVariables>
<environmentVariables>
<API_LOGIN_ID>API_LOGIN_ID</API_LOGIN_ID>
<TRANSACTION_KEY>TRANSACTION_KEY</TRANSACTION_KEY>
</environmentVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>net.authorize.api.controller.base.ApiOperationBase</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>resources</directory>
<filtering>true</filtering>
<includes>
<include>**/AuthorizedNetSensitiveTagsConfig.json</include>
</includes>
</resource>
<resource>
<directory>resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>log4j2.xml</exclude>
</excludes>
</resource>
</resources>
</build>
</project> Note you have to run |
Hi @patelbansari , I'm facing same problem. Have you found any solution? |
I'm using the below dependency to use sdk-java in android.
After a successful build, I tried to run the below code with sandbox details.
after run this code my app is getting crash with controller.getApiResponse() must not be null.
So i debugged the code and found one exception that is java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/Image; in HttpUtility.java class with postData method.
Does anyone have an idea about this?
The text was updated successfully, but these errors were encountered: