PK给ClassNotFoundException的androi

PK给ClassNotFoundException的androi

本文介绍了烧毛APK给ClassNotFoundException的android系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我产生烧焦的apk使用eclipse 导出签名的应用程序包。生成签署的apk我已经安装了之后,到我在那个时候我得到了设备不幸的是停止的例外出现这种情况是由于 ClassNotFoundException的。这个例外只发生与签署的apk。正常安装工作的罚款。

I am generating singed apk using eclipse Export Signed Application Package. After generating signed apk i have installed that into my device at that time I got unfortunately stopped exception this occurs due to ClassNotFoundException. This Exception occurs only with signed apk. Normal installation working fine.

我的错误日志

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的私人图书馆 Android的依赖订单和出口标记。我用 proguard.cfg 包含 -keep公共类*扩展android.app.Application 。我出口在皮棉错误检查时,未选中的复选框运行全面检查。请帮我拿到签名的apk文件,没有任何问题。谢谢你。

I have selected check boxes Android Private Libraries and Android Dependencies under Order and Exports tag. And I used proguard.cfg it contains -keep public class * extends android.app.Application. I unselected check box Run full check when exporting under Lint Error Checking. Please help me to get signed apk without any issue. Thank You.

推荐答案

我有同样的问题后,不能minifyEnabled真正解决了这一问题。如果只存在于签署APK的问题。检查buildtypes松开module.gradle

I had the same problem after disabling minifyEnabled true fixed the problem. if the problem only exist on signed apk. check buildtypes release on module.gradle

 buildTypes {
    release {
     // minifyEnabled true

    }
}

这篇关于烧毛APK给ClassNotFoundException的android系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 00:01