我正在使用eclipse Export Signed Application Package.
生成烧结的apk生成签名的apk后我已将其安装到我的设备中当时我unfortunately stopped exception
因ClassNotFoundException.
而发生这种情况只发生此异常签名apk。正常安装工作正常。
我的错误日志
05-14 18:48:39.561: E/AndroidRuntime(15982): FATAL EXCEPTION: main
05-14 18:48:39.561: E/AndroidRuntime(15982): java.lang.RuntimeException: Unable to instantiate application com.yyy.android.xxx.MyApplication: java.lang.ClassNotFoundException: com.yyy.android.xxx.MyApplication
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.app.LoadedApk.makeApplication(LoadedApk.java:482)
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3982)
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.app.ActivityThread.access$1300(ActivityThread.java:127)
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.os.Handler.dispatchMessage(Handler.java:99)
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.os.Looper.loop(Looper.java:137)
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.app.ActivityThread.main(ActivityThread.java:4503)
05-14 18:48:39.561: E/AndroidRuntime(15982): at java.lang.reflect.Method.invokeNative(Native Method)
05-14 18:48:39.561: E/AndroidRuntime(15982): at java.lang.reflect.Method.invoke(Method.java:511)
05-14 18:48:39.561: E/AndroidRuntime(15982): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809)
05-14 18:48:39.561: E/AndroidRuntime(15982): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576)
05-14 18:48:39.561: E/AndroidRuntime(15982): at dalvik.system.NativeStart.main(Native Method)
05-14 18:48:39.561: E/AndroidRuntime(15982): Caused by: java.lang.ClassNotFoundException: com.yyy.android.xxx.MyApplication
05-14 18:48:39.561: E/AndroidRuntime(15982): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-14 18:48:39.561: E/AndroidRuntime(15982): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-14 18:48:39.561: E/AndroidRuntime(15982): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.app.Instrumentation.newApplication(Instrumentation.java:942)
05-14 18:48:39.561: E/AndroidRuntime(15982): at android.app.LoadedApk.makeApplication(LoadedApk.java:477)
我的宣言:
<application
android:name=".MyApplication"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:logo="@drawable/title_logo"
android:theme="@style/Theme.App" >
<!-- Tablet Starts -->
<activity
android:name=".ui.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:screenOrientation="landscape"
android:theme="@style/Theme.App" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
我在Android Private Libraries
标记下选中了Android Dependencies
和Order and Exports
复选框。我使用的proguard.cfg
包含-keep public class * extends android.app.Application
。我取消选中Run full check when exporting
下的Lint Error Checking
复选框。请帮我签名apk没有任何问题。谢谢。
答案 0 :(得分:0)
确保你的proguard文件中有这个 -keep public class * extends android.app.Application ,如下所示:
-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.app.Fragment
-keep public class * extends android.widget.BaseAdapter
-keep class com.android.vending.billing.**
并确保 proguard文件确实正在使用。
答案 1 :(得分:0)
禁用minifyEnabled后我遇到了同样的问题,修正了问题。如果问题只存在于签名的apk上。检查module.gradle上的buildtypes发布。
GLint bufSize = 0;
glGetBufferParamteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, bufSize);