Giter VIP home page Giter VIP logo

Comments (3)

liuhy1989121 avatar liuhy1989121 commented on May 16, 2024

哥们,能请教一下怎么集成的吗,我怎么安装启动插件一直报插件的main activity没注册.我是按照文档配置的。而且我用测试demo也会报这个错误。

from droidplugin.

mejonzhan avatar mejonzhan commented on May 16, 2024

运行那个TestPlugin都会报错
FATAL EXCEPTION: main
E/AndroidRuntime(27823): Process: com.example.TestPlugin, PID: 27823
E/AndroidRuntime(27823): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.TestPlugin/com.example.TestPlugin.MyActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.TestPlugin.MyActivity" on path: DexPathList[[zip file "/data/app/com.example.TestPlugin-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.TestPlugin-1, /vendor/lib, /system/lib]]
E/AndroidRuntime(27823): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2122)
E/AndroidRuntime(27823): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
E/AndroidRuntime(27823): at android.app.ActivityThread.access$800(ActivityThread.java:140)
E/AndroidRuntime(27823): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1202)
E/AndroidRuntime(27823): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(27823): at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(27823): at android.app.ActivityThread.main(ActivityThread.java:5143)
E/AndroidRuntime(27823): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(27823): at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(27823): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(27823): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
E/AndroidRuntime(27823): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(27823): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.TestPlugin.MyActivity" on path: DexPathList[[zip file "/data/app/com.example.TestPlugin-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.TestPlugin-1, /vendor/lib, /system/lib]]
E/AndroidRuntime(27823): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime(27823): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
E/AndroidRuntime(27823): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
E/AndroidRuntime(27823): at android.app.Instrumentation.newActivity(Instrumentation.java:1063)
E/AndroidRuntime(27823): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2113)
E/AndroidRuntime(27823): ... 11 more

from droidplugin.

hellokugo avatar hellokugo commented on May 16, 2024

在公司用demo试了没问题,在家用一样的工程却报找不到类,这类明明是有的,怎么会没找到呢?肯定是配置出问题了。
1.首先,你得保证导入工程不能删除任何东西,这里说明下,一般我导入其他工程出现appcompat_v7\res\values-v23\styles_base_text.xml:19: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Inverse'.
做法都是把相关的报错xml删掉(因为一般用不到)就行了,但是这样会出现问题,在MyActivity类中继承的ActionBarActivity是从android.support.v7.app.ActionBarActivity import出来的,这就说明不能简单地删除,不然有可能出现You need to use a Theme.AppCompat theme (or descendant) with this activity.之类的错误;
2.后来没生成R文件,但是工程却没有红叉,这时候要看一下控制台的problems页面,发现要修改 android:minSdkVersion="11";
3.由于没找到的MyActivity是继承于ActionBarActivity,而ActionBarActivity从android.support.v7.app.ActionBarActivity import出来的,所以怀疑是v7包导入问题。所以,最最最重要的是,不知道为什么这次导入的工程队v7引用是在Java Build Path里面的导入,这里是一个关键坑!因为这种方式的导入和引用依赖的导入是不一样的概念,这也是这次出错的关键!
4.ok,只要把v7包改成工程依赖,不通过add jars这种方式引用就ok了,相信你们也是这个原因。

from droidplugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.