[英]Class not found exception in my android app
I have seen many issue similar to this and tried almost all solution. 我已经看到许多与此类似的问题,并尝试了几乎所有解决方案。 But nothing is working.
但是没有任何效果。 On android emulator app works good but when i try in my device it throws java.lang.ClassNotFoundException: in.thoughtsmith.jobsmith.SplachScreenActivity.
在android模拟器上,app运行良好,但是当我尝试在设备上运行时,它将抛出java.lang.ClassNotFoundException:in.thoughtsmith.jobsmith.SplachScreenActivity。
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{in.thoughtsmith.jobsmith/in.thoughtsmith.jobsmith.SplachScreenActivity}: java.lang.ClassNotFoundException: in.thoughtsmith.jobsmith.SplachScreenActivity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2034)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2143)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:174)
at android.app.ActivityThread.main(ActivityThread.java:4952)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: in.thoughtsmith.jobsmith.SplachScreenActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2143)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:174)
at android.app.ActivityThread.main(ActivityThread.java:4952)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
at dalvik.system.NativeStart.main(Native Method)
i have seen my manifest everything looks fine 我看过我的清单,一切看起来都很好
<application
android:name="in.thoughtsmith.jobsmith.JobSmithApplication"
android:allowBackup="true"
android:icon="@drawable/logo_only"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="in.thoughtsmith.jobsmith.SplachScreenActivity"
android:noHistory="true"
android:theme="@android:style/Theme.Light.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="in.thoughtsmith.jobsmith.MapsActivity"
android:label="@string/title_activity_maps" />
<activity android:name="in.thoughtsmith.jobsmith.JobSearchResultActivity" />
<activity
android:name="in.thoughtsmith.jobsmith.LoginActivity"
/>
<service
android:name="in.thoughtsmith.jobsmith.LocationCheckerService"
android:enabled="true"
android:exported="true" />
<activity android:name="in.thoughtsmith.jobsmith.FusedApiTestActivity" />
<activity android:name="in.thoughtsmith.jobsmith.ProfileUpdateActivity"></activity>
</application>
I want to make it clear that this app works fine in emulator and mobile device. 我想明确指出,此应用在模拟器和移动设备中均能正常运行。 But causes issue with on my device in which i was testing[ but it was working few days before on same device].
但是会导致我在其中进行测试的设备上出现问题[但是几天前在同一设备上工作了]。 Is this possible that some thing may be worng with my device.
我的设备可能会带点东西吗?
Many devices not work with instant run with debug mode so follow below steps 许多设备无法在调试模式下即时运行,因此请执行以下步骤
Disable instant run - 禁用即时运行-
Also Disable proguard in debug mode. 还要在调试模式下禁用proguard。
debug {
minifyEnabled false
useProguard false
}
Disable proguard and try 禁用proguard并尝试
In your app level build.gradle file, 在您的应用级别的build.gradle文件中,
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "in.thoughtsmith.jobsmith"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
minifyEnabled false
useProguard false <-------------------------------
applicationIdSuffix ".debug"
versionNameSuffix "-debug"
}
release {
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.