sktverma / maven-android-plugin

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

Class resolved by unexpected DEX ref had used a different during pre-verification #448

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
libraryprojects-tests is failing build on 3.8.3-SNAPSHOT due to a conflict with 
the AbstractActivityUsingResources

The test project lists the main apk (provided), the jar (provided), the aar 
(compile), the apklib (compile)

The class AbstractActivityUsingResources is contained in the apk (provided) and 
in the aar​ (compile)

The apk is not unpacked, so the AbstractActivityUsingResources class is not in 
not in the classes or generated-sources or anything

The aar is unpacked, so the class exists in 
target/unpacked-libs/com.jayway.maven.plugins.android.generation2.samples.librar
yprojects_libraryprojects-aar1/classes.jar​

​That classes.jar is added to the classpath, and the class is included inside 
the test apk

When the tests try to run, they run against the version in the test apk  
instead of the version in the main apk​ - causing conflict?
​
​I tried to change both the aar and apklib to provided.  When I did that, the 
classes.jar path was still added to the classpath -- but the entire 
unpacked-libs/ directory was not created -- thus it was unable to compile.​

Original issue reported on code.google.com by malac...@gmail.com on 22 Feb 2014 at 6:45

GoogleCodeExporter commented 9 years ago
If I remove these dependencies from the test project:
    <dependency>
      <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId>
      <artifactId>libraryprojects-aar-from-aar</artifactId>
      <version>${project.version}</version>
      <type>aar</type>
    </dependency>
    <dependency>
      <groupId>com.jayway.maven.plugins.android.generation2.samples.libraryprojects</groupId>
      <artifactId>libraryprojects-apklib-from-apklib</artifactId>
      <version>${project.version}</version>
      <type>apklib</type>
    </dependency>

And remove the generic from this class definition:
​public class MainActivityTest extends 
ActivityInstrumentationTestCase2<MainActivity>​

​Then all tests pass.​

​I think it would be preferred if we did not have to remove the generic from 
the ActivityInstrumentationTestCase2.

The reason it has to be removed is because the compiler can't resolve the 
parent of the MainActivity class. 
There is either:
1. no AbstractActivityUsingResources in the classpath (provided scope aar)
2. AbstractActivityUsingResources embedded in the test APK; causing conflict​ 
(compile scope aar)

I'll create a pull request anyway for review

Original comment by malac...@gmail.com on 22 Feb 2014 at 6:46

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