我已经看到许多与此类似的问题,并尝试了几乎所有解决方案。但是没有任何效果。在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)
我看过我的清单,一切看起来都很好
<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>
我想明确指出,此应用在模拟器和移动设备中均能正常运行。但是会导致我在其中进行测试的设备上出现问题[但是几天前在同一设备上工作了]。我的设备可能会带点东西吗?
最佳答案
许多设备无法在调试模式下即时运行,因此请执行以下步骤
禁用即时运行-
在文件菜单中单击设置,然后搜索即时运行并取消选中所有复选框,然后再次构建apk。
还要在调试模式下禁用proguard。
debug {
minifyEnabled false
useProguard false
}
关于java - 在我的android应用中找不到类异常,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/41888596/