我正在制作一个Android项目游戏,我最近在这个项目中添加了一些库,因为我做了同样的错误:
dex2oat : Failed to create oat file: /data/dalvik-cache/arm/data@app@***.*******.*************-2@base.apk@classes.dex: Permission denied
java.lang.ClassNotFoundException: Didn't find class "***.*******.*************.MainActivity" on path: DexPathList[[zip file "/data/app/***.*******.*************-1/base.apk"],nativeLibraryDirectories=[/data/app/***.*******.*************-1/lib/arm, /vendor/lib, /system/lib]]
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3132)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread.access$1100(ActivityThread.java:229)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7325)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.compgal.stealthsmiley.MainActivity" on path: DexPathList[[zip file "/data/app/com.compgal.stealthsmiley-1/base.apk"],nativeLibraryDirectories=[/data/app/com.compgal.stealthsmiley-1/lib/arm, /vendor/lib, /system/lib]]
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.Instrumentation.newActivity(Instrumentation.java:1096)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3122)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: ... 9 more
03-25 10:34:07.084 15904 15904 E AndroidRuntime: Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.compgal.stealthsmiley-1/base.apk
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.DexFile.openDexFileNative(Native Method)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.DexFile.openDexFile(DexFile.java:295)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.DexFile.<init>(DexFile.java:80)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.DexFile.<init>(DexFile.java:59)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.DexPathList.loadDexFile(DexPathList.java:279)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.DexPathList.makePathElements(DexPathList.java:248)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.DexPathList.<init>(DexPathList.java:120)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:48)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:65)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:86)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:47)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.LoadedApk.getClassLoader(LoadedApk.java:438)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.LoadedApk.makeApplication(LoadedApk.java:663)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6395)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread.access$1800(ActivityThread.java:229)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1887)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: ... 6 more
03-25 10:34:07.084 15904 15904 E AndroidRuntime: Suppressed: java.lang.ClassNotFoundException: ***.*******.*************.MainActivity
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at java.lang.Class.classForName(Native Method)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
03-25 10:34:07.084 15904 15904 E AndroidRuntime: ... 12 more
03-25 10:34:07.084 15904 15904 E AndroidRuntime: Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
我相信我应该说所有的项目/图书馆项目都使用相同的目标“android-23”。我已经检查了StackOverflow和其他网站上的所有答案,但无法找到解决我问题的任何答案。 谢谢你的帮助!
修改
该项目是在Netbeans IDE框架上编写的,而不是在android studio上,项目不是使用gradle。 这是AndroidManifest.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="***.*******.*************"
android:versionCode="7"
android:versionName="1.5">
<application android:label="@string/app_name" android:icon="@drawable/icon"
>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity
android:screenOrientation="landscape"
android:name="MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
编辑#2
经过一些挖掘后,似乎dex2oat尝试创建燕麦文件时出现问题:
dex2oat : Failed to create oat file: /data/dalvik-cache/arm/data@app@***.*******.*************-2@base.apk@classes.dex: Permission denied
我不知道现在该做什么。 参考图书馆:Google Play服务和Android支持v13。 如果我删除库,项目工作正常......那么问题是什么?
答案 0 :(得分:3)
我的这个问题通过以下方式解决: - 1)清洁2)构建 - &gt;建立Apk。而这个Apk之前工作得很好我只是应用app-&gt; build-&gt; output-&gt; apk。
答案 1 :(得分:1)
好吧,所以经过长时间的搜索后发现问题出在Android的sdk经理身上 - 我下载所有的构建工具时只需要下载一个。 所以我删除了所有不必要的包,项目现在正常工作。 感谢那些试图帮助的人!