0

After exporting signed package from eclipse, application started crashing when one of activities is invoked.

05-30 23:05:43.814: E/AndroidRuntime(11578): FATAL EXCEPTION: main
05-30 23:05:43.814: E/AndroidRuntime(11578): java.lang.NoClassDefFoundError: com.encryptomatic.alockbin.ItemListActivity

I completely excluded that class from obfuscation with all members and I see it listed in seeds.txt .

Only difference from other activities is that this one extends SherlockFragmentActivity. I excluded dependencies altogether using:

-keep class android.support.v4.app.** { *; } 
-keep interface android.support.v4.app.** { *; } 
-keep class com.actionbarsherlock.** { *; } 
-keep interface com.actionbarsherlock.** { *; } 
-keepattributes *Annotation*

What could be wrong here? How can I check if my class really ended in apk?

Velja Radenkovic
  • 716
  • 1
  • 6
  • 27
  • Try with `-keep public class * extends package_of_SherlockFragmentActivity.SherlockFragmentActivity` – Pankaj Kumar May 31 '13 at 07:02
  • Is this an older project and you have recently updated your Android Developer tools? Try what happens if you disable ProGuard. – Robert May 31 '13 at 07:52

2 Answers2

2

The quick answer is: ProGuard was unable to detect that the class com.encryptomatic.alockbin.ItemListActivity is used by your code and therefore has removed it. This can happen if it is loaded dynamically or in a different unusual way.

Therefore if you use ProGuard you should simply add the mentioned class as class to "keep":

 -keep class com.encryptomatic.alockbin.ItemListActivity { public *; } 

Then re-build the APK and try it. Test all features of your app as most likely there are other classes that has to be configured to keep. If you have identified all classes also check the ProGuard warnings as they usually contain other classes that may be wise to keep.

hcarver
  • 7,126
  • 4
  • 41
  • 67
Robert
  • 39,162
  • 17
  • 99
  • 152
  • So classes that are loaded this way: Intent intent = new Intent(this, ItemListActivity.class); are not detected by proguard? Let me try quickly and get back to you. – Velja Radenkovic May 31 '13 at 07:15
  • No that doesn't work. When I look proguard cfg I already kept that class with: -keep public class * extends com.actionbarsherlock.app.SherlockFragmentActivity{*;} and as I said it is listed in seeds meaning that it is not processed. There are also 3 activities before this one that are loaded same way through intent. – Velja Radenkovic May 31 '13 at 07:23
  • If you have configured it already why you don't write that in your question? The presented ProGuard config does not include anything like this. – Robert May 31 '13 at 07:50
  • Quote from my question "I completely excluded that class from obfuscation with all members and I see it listed in seeds.txt ." Ah sorry I see now ... Its not entire proguard file its just part where I show how I excluded class dependencies. – Velja Radenkovic May 31 '13 at 07:54
0

android-support-v4.jar was not set to export under Java Build Path in project properties:

Right click on Project -> Properties -> Java Build Path -> Order and export -> Check checkbox "Android private libraries" (the node where android-support-v4.jar resides on Library tab)

Velja Radenkovic
  • 716
  • 1
  • 6
  • 27
  • Is this your problem solution? If anybody else has the same problem this answer will not help much as it is not understandable. – Robert May 31 '13 at 07:53
  • 1
    It worked for me: One of my class is extends from android.support.v4.app.FragmentActivity, after check the "Android private libraries". It works. – Shuai Jun 27 '13 at 08:12