Obfuscate Android Test, as well as the project (launch the release and obfuscation test)

Say I have an Android app project with tests.

Is there any way to run our test suite (in a separate test project) against the release version?

+5
source share
3 answers

After reading the comment about the bonus, I realized that the OP is really asking for something more than a simple “Yes / No” answer, so I'm going to extend my comment to the answer. Generally speaking, a properly developed proguard.cfg and project structure are sufficient to prevent this dilemma.

proguard (. 7. Android ) , Android , Activity, View .. . , , Acticity.onCreate(), , , . , proguard.cfg .

... ...

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider

-keep public class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

... ...

, Android Android ( ), .. , POJO, Android API, , POJO - , . junit POJO java, junit maven (, zipaligned). , OO POJO , .. .

app/
  src/main/java/
  src/test/java/  <-- intermediate POJO tests put here.
  AndroidManifest.xml
  ... ...
app-test/
  src/main/java  <-- Android component tests put here.
  AndroidManifest.xml
  ... ...

POJO junit Android, , apk, proguard.cfg POJO , .

+2

proguard -printmapping <filename>. Hashtable. script, ( ). - ( ), Java, - ( , ) , . .

+1

? , , maven , .

To fix this, you will need to move the tests to a separate project that is associated with your actual application (if you rely on the code / assets of your actual project), then a separate project will still be able to use the tool to release your application (provided that they are signed with the same key).

0
source

All Articles