当前位置: 代码迷 >> Android >> Android appcompat_v7无法启动
  详细解决方案

Android appcompat_v7无法启动

热度:105   发布时间:2023-08-04 11:50:11.0

我在这里看到了类似的问题,但是没有人能帮助我。 我正在使用日食。 在我的项目中,我使用RoundedImageView-master作为库。 这意味着,我在eclipse中的“ main”项目中没有源,而“ gen”文件夹中的包名为:com.makeramen.roundedimageview,而我的appcompat_v7-project和lib android-support-v7-appcompat.jar。

我在布局中使用的不是“ ... res-auto”,而是这样:

 xmlns:app="http://schemas.android.com/apk/lib/com.makeramen.roundedimageview"

在我的主要活动中,我导入了以下内容:

import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.design.widget.NavigationView;
import android.support.design.widget.NavigationView.OnNavigationItemSelectedListener; 

在我的构建路径中,进入节库的是我的“主”项目。 现在我想启动我的应用程序,但是我从cat_log获取:

FATAL EXCEPTION: main
Process: com.hdd.myExampleApp, PID: 3454
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.hdd.myExampleApp/com.hdd.myExampleApp.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.hdd.myExampleApp.MainActivity" on path: DexPathList[[zip file "/data/app/com.hdd.myExampleApp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
    at android.app.ActivityThread.access$800(ActivityThread.java:144)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:135)
    at android.app.ActivityThread.main(ActivityThread.java:5221)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.hdd.myExampleApp.MainActivity" on path: DexPathList[[zip file "/data/app/com.hdd.myExampleApp-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
    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:1065)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2199)
    ... 10 more
    Suppressed: java.lang.NoClassDefFoundError: com.hdd.myExampleApp.MainActivity
        at dalvik.system.DexFile.defineClassNative(Native Method)
        at dalvik.system.DexFile.defineClass(DexFile.java:226)
        at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
        at dalvik.system.DexPathList.findClass(DexPathList.java:321)
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
        ... 14 more
    Suppressed: java.lang.ClassNotFoundException: com.hdd.myExampleApp.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)
        ... 13 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

控制台对我说:

[myExampleApp] Android Launch!
[myExampleApp] adb is running normally.
[myExampleApp] Performing com.hdd.myExampleApp.MainActivity activity launch
[2myExampleApp] Uploading myExampleApp.apk onto device '192.168.56.101:5555'
[2myExampleApp] Installing myExampleApp.apk...
[myExampleApp] Success!
[myExampleApp] Project dependency found, installing: main
[main] Uploading main.apk onto device '192.168.56.101:5555'
[main] Installing main.apk...
[main] Success!
[myExampleApp] Starting activity com.hdd.myExampleApp.MainActivity on device 192.168.56.101:5555
[myExampleApp] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.hdd.myExampleApp/.MainActivity }

我认为,我必须在清单中包括如下内容:

 <uses-library android:name="com.makeramen.roundedimageview"/>

这个包名称出现在我的主项目的gen文件夹中。 当我开始时,我从控制台上看到:

[myExampleApp] Android Launch!
[myExampleApp] adb is running normally.
[myExampleApp] Performing com.hda.myExampleApp.MainActivity activity launch
[myExampleApp] Uploading myExampleApp.apk onto device '192.168.56.101:5555'
[myExampleApp] Installing myExampleApp.apk...
[myExampleApp] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[myExampleApp] Please check logcat output for more details.
[myExampleApp] Launch canceled!

我没有想法了,我该怎么办。 请帮我 :)

您必须仅使用xmlns:app="http://schemas.android.com/apk/res-auto"而android本身会找到相对资源。

  相关解决方案