Unable to automate Android UI-Tests on Jenkins-Server due to complex dependencies between lib projects of the main project (s)

In the short term, my project structure is as follows:
 - A and B - android lib projects, where B depends on A - C (normal android project) depends on B
 - T - test project C

I have, accordingly, two projects on my jenkins server, one for C and one for T, which have their own script to build, using in fact only the android and ant commands. This way, there is no problem with building C, but I can't get the build working.

"Work" should mean that, depending on the script, it either does not compile or does not execute at runtime due to some missing classes that actually cannot be, or do not skip the dexing phases due to the addition of duplicates.

So, it’s clear that something is wrong with the dependencies, but the interesting thing is that it works very well on the local machine with eclipse and on the emulator.

So, here is a sample shell script code that should actually work and create an apk file:

cd project-test
android update test-project -m ../projectC -p .
ant clean debug

This makes it unfortunate that some classes from B that I am also going to test cannot be found from the java compiler, and I always get this error:

...
[javac] Compiling 14 source files to /home/mehmed/git/project/test-project/bin/classes
[javac] SomeActivityTest.java:8: package com.mydomain.portal.android.project.activity does not exist
[javac] import com.mydomain.portal.android.project.activity.SomeClass1;
[javac]                                                        ^
[javac] SomeActivityTest.java:9: package com.mydomain.portal.android.project.data does not exist
[javac] import com.mydomain.portal.android.project.data.SomeClass2;
[javac]                                                    ^
[javac] SomeActivityTest.java:10: package com.project.portal.android.project.util does not exist
[javac] import com.mydomain.portal.android.project.util.SomeClass3;
[javac]                                                    ^
...

I tried almost everything to fix this, even manually editing the project.properties file and including only B or B and C at the same time with such lib projects like this:

cd project-test
android update test-project -m ../projectC -p .
echo "android.library.reference.1=../projectB" >> project.properties
# or even also projectA:
echo "android.library.reference.2=../projectA" >> project.properties
ant clean debug

dexing - lib-.

- ? !

+5
2

T, SomeActivityTest, / / B / C > , , / . , :

[javac] SomeActivityTest.java:8: package com.mydomain.portal.android.project.activity does not exist
[javac] import com.mydomain.portal.android.project.activity.SomeClass1;
[javac]                                                        ^
[javac] SomeActivityTest.java:9: package com.mydomain.portal.android.project.data does not exist

, Project Project, Ant build, , dexing. Eclipse ADT , , Eclipse:

[dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] java.lang.IllegalArgumentException: already added: Lcom/mydomain/...;
[dx]     at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[dx]     at com.android.dx.dex.file.DexFile.add(DexFile.java:163)

( Ant script), .

, SDK, . changelog, , SDK , Test Project. , , . , .

+1

Android- # 21720 β€” Android , .

16 17, .

+1

All Articles