Jar project uses several third-party package, do not confuse the need for third-party confusion when Jar package
My proguard.cfg reads as follows:
-Optimizationpasses 5
-Dontusemixedcaseclassnames
-Dontskipnonpubliclibraryclasses
-Dontpreverify
#-Ignorewarnings
-Verbose
-Optimizations! Code / simplification / arithmetic,! Field / *,! Class / merging / *
-Keepattributes * Annotation *
-Keepattributes Signature
-Libraryjars libs/android-support-v4.jar
-Libraryjars libs/commons-net-3.2.jar
-Libraryjars libs / open_sdk.jar
-Libraryjars libs/ormlite-android-4.42.jar
-Libraryjars libs / umeng_sdk.jar
-Libraryjars libs/ormlite-core-4.42.jar
-Keep public class * extends android.app.Fragment
-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.app.backup.BackupAgentHelper
-Keep public class * extends android.preference.Preference
-Keep public class * extends android.support.v4. **
#-Keep public class * extends org.apache.commons.net. **
#-Keep public class * extends com.tencent. **
#-Keep public class * extends com.umeng. **
#-Keep public class * extends com.umeng.analytics. **
#-Keep public class * extends com.umeng.common. **
#-Keep public class * extends com.umeng.newxp. **
#-Keep public class * extends com.j256.ormlite. **
#-Keep public class * extends com.j256.ormlite.android. **
#-Keep public class * extends com.j256.ormlite.field. **
#-Keep public class * extends com.j256.ormlite.stmt. **
-Keep public class * extends com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
-Keep public class * extends com.j256.ormlite.android.apptools.OpenHelperManager
-Keep class com.android.vending.licensing.ILicensingService
-Keep class android.support.v4 ** {*;}.
-Keep class org.apache.commons.net ** {*;}.
-Keep class com.tencent ** {*;}.
-Keep class com.umeng ** {*;}.
-Keep class com.umeng.analytics ** {*;}.
-Keep class com.umeng.common ** {*;}.
-Keep class com.umeng.newxp ** {*;}.
-Keep class com.j256.ormlite ** {*;}.
-Keep class com.j256.ormlite.android ** {*;}.
-Keep class com.j256.ormlite.field ** {*;}.
-Keep class com.j256.ormlite.stmt ** {*;}.
-Dontwarn android.support.v4. **
-Dontwarn org.apache.commons.net. **
-Dontwarn com.tencent. **
-Dontwarn com.umeng. **
-Dontwarn com.umeng.analytics. **
-Dontwarn com.umeng.common. **
-Dontwarn com.umeng.newxp. **
-Dontwarn com.j256.ormlite. **
-Dontwarn com.j256.ormlite.android. **
-Dontwarn com.j256.ormlite.field. **
-Dontwarn com.j256.ormlite.stmt. **
-Keepclasseswithmembernames class * {
native;
}
-Keepclasseswithmembers class * {
public(android.content.Context, android.util.AttributeSet);
}
-Keepclasseswithmembers class * {
public(android.content.Context, android.util.AttributeSet, int);
}
-Keepclassmembers class * extends android.app.Activity {
public void * (android.view.View);
}
-Keepclassmembers enum * {
public static ** [] values ();
public static ** valueOf (java.lang.String);
}
-Keep class * implements android.os.Parcelable {
public static final android.os.Parcelable $ Creator *;
}
Log.txt following error message after running, I tried to adjust, but eventually failed!
04-18 18:32:16.619: E / AndroidRuntime (8902): FATAL EXCEPTION: main
04-18 18:32:16.619: E / AndroidRuntime (8902): java.lang.RuntimeException: Unable to create application com.ishow.funnymap.FunnyApplication: java.lang.IllegalStateException: Could not find constructor that hast just a (Context ) argument for helper class class com.ishow.funnymap.database.DatabaseHelper
04-18 18:32:16.619: E / AndroidRuntime (8902): at android.app.ActivityThread.handleBindApplication (ActivityThread.java: 4118)
04-18 18:32:16.619: E / AndroidRuntime (8902): at android.app.ActivityThread.access $ 1300 (ActivityThread.java: 134)
04-18 18:32:16.619: E / AndroidRuntime (8902): at android.app.ActivityThread $ H.handleMessage (ActivityThread.java: 1285)
04-18 18:32:16.619: E / AndroidRuntime (8902): at android.os.Handler.dispatchMessage (Handler.java: 99)
04-18 18:32:16.619: E / AndroidRuntime (8902): at android.os.Looper.loop (Looper.java: 154)
04-18 18:32:16.619: E / AndroidRuntime (8902): at android.app.ActivityThread.main (ActivityThread.java: 4624)
04-18 18:32:16.619: E / AndroidRuntime (8902): at java.lang.reflect.Method.invokeNative (Native Method)
04-18 18:32:16.619: E / AndroidRuntime (8902): at java.lang.reflect.Method.invoke (Method.java: 511)
04-18 18:32:16.619: E / AndroidRuntime (8902): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 809)
04-18 18:32:16.619: E / AndroidRuntime (8902): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 576)
04-18 18:32:16.619: E / AndroidRuntime (8902): at dalvik.system.NativeStart.main (Native Method)
04-18 18:32:16.619: E / AndroidRuntime (8902): Caused by: java.lang.IllegalStateException: Could not find constructor that hast just a (Context) argument for helper class class com.ishow.funnymap.database.DatabaseHelper
04-18 18:32:16.619: E / AndroidRuntime (8902): at com.j256.ormlite.android.apptools.OpenHelperManager.constructHelper (Unknown Source)
04-18 18:32:16.619: E / AndroidRuntime (8902): at com.j256.ormlite.android.apptools.OpenHelperManager.loadHelper (Unknown Source)
04-18 18:32:16.619: E / AndroidRuntime (8902): at com.j256.ormlite.android.apptools.OpenHelperManager.getHelper (Unknown Source)
04-18 18:32:16.619: E / AndroidRuntime (8902): at com.ishow.funnymap.database.DatabaseHelper.a (Unknown Source)
04-18 18:32:16.619: E / AndroidRuntime (8902): at com.ishow.funnymap.FunnyApplication.onCreate (Unknown Source)
04-18 18:32:16.619: E / AndroidRuntime (8902): at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java: 969)
04-18 18:32:16.619: E / AndroidRuntime (8902): at android.app.ActivityThread.handleBindApplication (ActivityThread.java: 4115)
04-18 18:32:16.619: E / AndroidRuntime (8902): ... 10 more
04-18 18:32:16.619: E / AndroidRuntime (8902): Caused by: java.lang.NoSuchMethodException:[class android.content.Context]
04-18 18:32:16.619: E / AndroidRuntime (8902): at java.lang.Class.getConstructorOrMethod (Class.java: 460)
04-18 18:32:16.619: E / AndroidRuntime (8902): at java.lang.Class.getConstructor (Class.java: 431)
04-18 18:32:16.619: E / AndroidRuntime (8902): ... 17 more
Thank you very much, if you know where there are problems, please reply to me or Email me: 469985793@qq.com
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Add a few questions:
Caused by: java.lang.IllegalStateException: Could not find constructor that hast just a (Context) argument for helper class class com.ishow.funnymap.database.DatabaseHelper
Caused by: java.lang.NoSuchMethodException:[class android.content.Context]
/ / To see the error message should not be invoked to display constructed been emptied!
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
private static final String DATABASE_NAME = "safford.db";
private static final int DATABASE_VERSION = 11;
private final String TAG = "DatabaseHelper";
private DaoconnotationEssayDao;
private DaopostDao;
private static volatile DatabaseHelper instance;
public static void init (Context context) {
if (instance == null) {
instance = (DatabaseHelper) OpenHelperManager.getHelper (context,
DatabaseHelper.class);
/ / Call this to make sure database be created / updated when init.
instance.getReadableDatabase ();
}
}
....
}
Reply:
Why not use the system comes confusion na
Reply:
To confuse this kind of release
Reply:
Ormlite use reflection, reflection class does not need to be confused.
Reply:
Ask what is the general idea of code obfuscation is ah
Reply:
I use
-Keepattributes Signature
To avoid confusion generic
And see the error should be implicit structure was cleaned out!
I do not have a good solution!
You said not to be confused reflection, specifically how to operate it?
Reply:
Here is the confusion that comes with Android
Reply:
're Trying to separate the frame, only the framework of confusion!
Reply:
Landlord problem solved? Find the answer ah posted
No comments:
Post a Comment