Tuesday, 3 September 2013

Error when using APKLIB

Error when using APKLIB

I am new in using maven in Android. And I try to use maven to build my
project. I want to build an application that using a library project (
library is my own project ). I try to using apklib.
This is a library project's pom file
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ati</groupId>
<artifactId>soci-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.ati.android</groupId>
<artifactId>common-lib</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apklib</packaging>
<name>common-lib</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version>2.2.1</platform.version>
<android.plugin.version>3.6.1</android.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<!-- <version>${platform.version}</version> -->
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>8</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
And application pom file:
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ati</groupId>
<artifactId>soci-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.ati.sociapp</groupId>
<artifactId>soci</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>soci</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<platform.version> 2.2.1
</platform.version>
<android.plugin.version>3.6.1</android.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<!-- <version>${platform.version}</version> -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ati.android</groupId>
<artifactId>common-lib</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>apklib</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>${android.plugin.version}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>8</platform>
</sdk>
</configuration>
</plugin>
</plugins>
</build>
</project>
Now in activity of application I import and use a library but error
occurs: import com.ati.android; and Test.demo();
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
(default-compile) on project soci: Compilation failure: Compilation
failure:
[ERROR]
/Data/Work/workspace/soci-news/soci/src/main/java/com/ati/soci/HelloAndroidActivity.java:[7,15]
cannot find symbol
[ERROR] symbol : class android
[ERROR] location: package com.ati
[ERROR]
/Data/Work/workspace/soci-news/soci/src/main/java/com/ati/soci/HelloAndroidActivity.java:[21,9]
cannot find symbol
[ERROR] symbol : variable Test
[ERROR] location: class com.ati.soci.HelloAndroidActivity
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the
-e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the
command
[ERROR] mvn <goals> -rf :soci
I am sure that Test.java is in library project with package name is:
"com.ati.android". Could you tell me what I did not correct. I spent few
hours to find but no luck. Thank!

No comments:

Post a Comment