0

I'm trying to create a script to automate the signed exportation of my android apps (to avoid manual work when I release an update to all my apps).

I've followed this tutorial: http://www.enterra-inc.com/techzone/using_ant_android_applications_building/ and others, very similar to this one.

I'm testing with 1 project by now, which includes mopub-sdk library, among others and I get a lot of errors, like this one (only with ANT build):

[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdFetcherTest.java:62: error: static import only from classes and interfaces
[javac] import static org.mockito.Mockito.verify;
[javac] ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdFetcherTest.java:64: error: cannot find symbol
[javac] @RunWith(SdkTestRunner.class)
[javac]  ^
[javac]   symbol: class RunWith
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:41: error: package org.junit does not exist
[javac] import org.junit.Before;
[javac]                 ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:42: error: package org.junit does not exist
[javac] import org.junit.Test;
[javac]                 ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:43: error: package org.junit.runner does not exist
[javac] import org.junit.runner.RunWith;
[javac]                        ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:58: error: package org.fest.assertions.api does not exist
[javac] import static org.fest.assertions.api.Assertions.assertThat;
[javac]                                      ^
[javac] D:\Documents\Applications\Eclipse\Projects\mopub-sdk\src\test\java\com\mopub\mobileads\AdLoadTaskTest.java:58: error: static import only from classes and interfaces

When I compile with Eclipse, everything is fine.

I think I did everything OK, but there is only 1 thing that is bothering me.

For some reason, when I imported the mopub-sdk project, it showed src/main/java directory instead of just src like the rest of the projects.

Wrong Import of mopub-sdk project?

So, my question is:

1) How can I solve these errors so I can finally build automatically all my apps.

2) It the folder structure of mopub-sdk is the cause of the problem: how can I solve it?

UPDATE:

While trying to reimport the mopub-sdk project, I'm getting this error.

eclipse import error

Dandy
  • 303
  • 5
  • 14
  • Anyone? I really need a solution. It's not a unique thing. I'm sure many of you bumped into this problem. – Dandy May 17 '14 at 08:41

2 Answers2

0

I found the solution. The problem was finally mopub-sdk library project and the problems at the import stage.

I fixed the nested directory issue within the src/ folder and the build was successful.

Dandy
  • 303
  • 5
  • 14
  • Hello, Dandy! I got the same problem now. Could you please explain, how exactly did you fix the nested directory issue? – nickeyzzz Aug 02 '14 at 20:13
  • I don't remember exactly, right know, but it was related to what options you import with. Pay attention to those steps. – Dandy Aug 04 '14 at 01:59
  • We just removed the 'test' folder to get the ANT compile to work. http://stackoverflow.com/questions/23698998/android-ant-build-lots-of-mopub-errors/28506628#28506628 – Hunter-Orionnoir Feb 13 '15 at 19:00
0

To fix our ANT build remove the 'test' folder under src and the compile errors in ANT went away.

Specifically the files in this part of the downloaded SDK: https://github.com/mopub/mopub-android-sdk/tree/master/mopub-sdk/src/test

Hunter-Orionnoir
  • 2,015
  • 1
  • 18
  • 23
  • I was tempted to a do a pull request that just removed those files and push that up, but I think the testing parts of the project want these. But we appear fine in production (~3 hours of testing with no errors), but without having time to really test that impact in the whole project it felt a little 'trollish' to do that. – Hunter-Orionnoir Feb 13 '15 at 18:52