kingdom578 / maven-android-plugin

Automatically exported from code.google.com/p/maven-android-plugin
0 stars 0 forks source link

java.lang.NoClassDefFoundError with the aapt options --rename-manifest-package and --rename-instrumentation-target-package #450

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create an Android projet with the android-release archetype available on the 
link https://github.com/akquinet/android-archetypes

2. In the projet Android, add configuration in the plugin android-maven-plugin :
<renameManifestPackage>${project.groupId}.std</renameManifestPackage>

3. In the projet Android-it, add configuration in the plugin 
android-maven-plugin :

<renameManifestPackage>${project.groupId}.std</renameManifestPackage>
<renameInstrumentationTargetPackage>${project.groupId}.std</renameInstrumentatio
nTargetPackage>

<instrumentationPackage>${project.groupId}.dev</instrumentationPackage>
<instrumentationRunner>android.test.InstrumentationTestRunner</instrumentationRu
nner>

What is the expected output?

> mvn clean verify 
...
[INFO] --- android-maven-plugin:3.8.2:internal-integration-test 
(default-internal-integration-test) @ android-demo-it ---
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter not set, using all attached devices
[INFO] Device 4df19dd060da5f81_samsung_GT-I9300 found.
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :   Running tests for specified test 
package: com.xxx.demo.test
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :   Running instrumentation tests in 
com.xxx.demo.test
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :     Run started: com.xxx.demo.test, 
1 tests:
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :       Start [1/1]: 
com.xxx.demo.test.HelloAndroidActivityTest#testActivity
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :       End [1/1]: 
com.xxx.demo.test.HelloAndroidActivityTest#testActivity
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :     Run ended: 632 ms
[INFO]   Tests run: 1,  Failures: 0,  Errors: 0
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :   Report file written to 
D:\workshop\Perso\repo\git\perso\android-demo-parent\android-demo-it\target-dev\
surefire-reports\TEST-4df19dd060da5f81_samsung_GT-I9300.xml
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] android-demo - Parent ............................. SUCCESS [0.163s]
[INFO] android-demo - Application ........................ SUCCESS [10.197s]
[INFO] android-demo-it - Integration tests ............... SUCCESS [29.012s]
[INFO] ------------------------------------------------------------------------

What do you see instead?

> mvn clean verify 
...
[INFO] --- android-maven-plugin:3.8.2:internal-integration-test 
(default-internal-integration-test) @ android-demo-it ---
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] android.device parameter not set, using all attached devices
[INFO] Device 4df19dd060da5f81_samsung_GT-I9300 found.
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :   Running tests for specified test 
package: com.xxx.demo.test
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :   Running instrumentation tests in 
com.xxx.demo.dev
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :     Run started: com.xxx.demo.dev, 1 
tests:
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :       Start [1/1]: 
android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests#testSuiteConstruc
tionFailed
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :       
ERROR:android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests#testSuiteCo
nstructionFailed
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :       java.lang.RuntimeException: 
Exception during suite construction
at 
android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests.testSuiteConstruc
tionFailed(TestSuiteBuilder.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at 
android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:55
4)
at 
android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1738)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.test.suitebuilder.TestMethod.instantiateTest(TestMethod.java:87)
at android.test.suitebuilder.TestMethod.createTest(TestMethod.java:73)
at android.test.suitebuilder.TestSuiteBuilder.addTest(TestSuiteBuilder.java:262)
at android.test.suitebuilder.TestSuiteBuilder.build(TestSuiteBuilder.java:184)
at 
android.test.InstrumentationTestRunner.onCreate(InstrumentationTestRunner.java:3
79)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4675)
at android.app.ActivityThread.access$1400(ActivityThread.java:159)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.xxx.demo.HelloAndroidActivity
at 
com.xxx.demo.test.HelloAndroidActivityTest.<init>(HelloAndroidActivityTest.java:
9)
... 18 more

[INFO] 4df19dd060da5f81_samsung_GT-I9300 :       End [1/1]: 
android.test.suitebuilder.TestSuiteBuilder$FailedToCreateTests#testSuiteConstruc
tionFailed
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :     Run ended: 24 ms
[ERROR] 4df19dd060da5f81_samsung_GT-I9300 :     FAILURES!!!
[INFO]   Tests run: 1,  Failures: 0,  Errors: 1
[INFO] 4df19dd060da5f81_samsung_GT-I9300 :   Report file written to 
D:\workshop\Perso\repo\git\perso\android-demo-parent\android-demo-it\target-dev\
surefire-reports\TEST-4df19dd060
da5f81_samsung_GT-I9300.xml
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] android-demo - Parent ............................. SUCCESS [0.112s]
[INFO] android-demo - Application ........................ SUCCESS [11.781s]
[INFO] android-demo-it - Integration tests ............... FAILURE [2:26.717s]
[INFO] ------------------------------------------------------------------------

Error :
Caused by: java.lang.NoClassDefFoundError: com.xxx.demo.HelloAndroidActivity
at 
com.xxx.demo.test.HelloAndroidActivityTest.<init>(HelloAndroidActivityTest.java:
9)

Except I'm mistaken, the class HelloAndroidActivity should be always found in 
the package com.xxx.demo even thouth the manifest package is renamed.

   --rename-manifest-package
       Rewrite the manifest so that its package name is the package name
       given here.  Relative class names (for example .Foo) will be
       changed to absolute names with the old package so that the code
       does not need to change.
   --rename-instrumentation-target-package
       Rewrite the manifest so that all of its instrumentation
       components target the given package.  Useful when used in
       conjunction with --rename-manifest-package to fix tests against
       a package that has been renamed.

What version of maven-android-plugin are you using?

android-maven-plugin:3.8.2

What are the complete output lines of "mvn -version" on your machine?

$ mvn --version
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 
17:22:22+0200)
Maven home: d:\bin\apache-maven-3.1.1
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: c:\Program Files (x86)\Java\jdk1.7.0_45\jre
Default locale: fr_FR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

Please provide any additional information below.

Original issue reported on code.google.com by franck.s...@gmail.com on 5 Mar 2014 at 5:15

GoogleCodeExporter commented 9 years ago
Franck, can you post a link to project that fails.

Original comment by william....@xandar.com.au on 10 Mar 2014 at 11:48

GoogleCodeExporter commented 9 years ago
We are no longer using the issue tracking system on Google Code. Please refile 
this issue on https://github.com/jayway/maven-android-plugin/issues if you 
still have this problem with the latest release of the Android Maven Plugin

Original comment by mosa...@gmail.com on 19 May 2014 at 4:20