gpt4 book ai didi

java - 在路径上找不到 MainActivity

转载 作者:太空宇宙 更新时间:2023-11-03 12:47:04 24 4
gpt4 key购买 nike

我正在使用 android studio 2.3 beta 1 以及这些配置

compileSdkVersion 25

buildToolsVersion "25.0.2"

applicationId "octave.foodster"

minSdkVersion 19

targetSdkVersion 25

问题是,当我通过 android studio 运行一个应用程序时,一切正常,但是当我将同一个应用程序的 apk 发送到另一部手机时,它崩溃了。我只是在使用一个基本的 Activity ,所以只是 android studio 的默认模板在您创建新项目时创建。我没有添加任何外部库或任何其他内容。

list 文件

<?xml version="1.0" encoding="utf-8"?>

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

我得到的错误是

E/AndroidRuntime: FATAL EXCEPTION: main
Process: octave.foodster, PID: 8580
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{octave.foodster/octave.foodster.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "octave.foodster.MainActivity" on path: DexPathList[[zip file "/data/app/octave.foodster-1/base.apk"],nativeLibraryDirectories=[/data/app/octave.foodster-1/lib/arm64, /vendor/lib64, /system/lib64]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2566)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2725)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1572)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5896)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
Caused by: java.lang.ClassNotFoundException: Didn't find class "octave.foodster.MainActivity" on path: DexPathList[[zip file "/data/app/octave.foodster-1/base.apk"],nativeLibraryDirectories=[/data/app/octave.foodster-1/lib/arm64, /vendor/lib64, /system/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at android.app.Instrumentation.newActivity(Instrumentation.java:1072)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2556)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2725) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1572) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5896) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
Suppressed: java.lang.ClassNotFoundException: octave.foodster.MainActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 12 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

最佳答案

当我尝试在启用即时运行的情况下运行 apk 时,我遇到了同样的问题。

解决方案:-

Disable the instant run and install that apk in the device it will work.

快乐编码。享受。

关于java - 在路径上找不到 MainActivity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41385449/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com