(1)Caused by : java.lang.ClassNotFoundException: Didn't find class "com.alina.mystar.MainActivity" on path: DexPathList[[zip file "/data/app/com.alina.mystar-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
可以从以下几个方面进行检查:
①Manifest文件中注册的Activity的名称、包名有没有错误,如果使用".MainActivity"的补全完整后再测试是否可以。
②如果有引用第三方的包,是否是加载libs这个文件夹中
③在Java Build Path面板下的Order and Export中,一定要把引入的jar文件选上。
(2)'<>' operator is not allowed for source level blow 1.7
编译环境与项目的要求不对应造成的解决这个问题可以从以下两个方面考虑:
(1)选中项目 ——> 右键 — —> Properities ——> Java Compiler ——> 勾选Enable project specific settings ——> Compiler compliance level ——> 选择1.7 ——> OK
(2)类似 Vector<DTO> dto = new Vector<>();这样的写法在当前环境不支持,改成Vector<DTO> dto = new Vector<DTO>();后是否可行(只是提供参考,可能SDK版本和形式不兼容)
(3)内部广播在Manifest.xml中注册时应为:
android:name="com.alina.mystar.MainActivity$MyReceiver"
或者在Activity采用动态注册
mMyReceiver = new MyReceiver();
IntentFilter filter = new IntentFilter("......");
registerReceiver(mMyReceiver, filter);
(4) java.lang.RuntimeException: Unable to instantiate receiver com.alina.mystar.MainActivity$EnterNextReceiver: java.lang.InstantiationException: class
静态注册内部广播时,内部广播的类型需要为static类型,如:public static class MyBroadcastReceiver extends Broadcast {......"
(5) RecyclerView在eclipse中的使用:
将sdk中extras\android\m2repository\com\android\support\recyclerview-v7\21.0.0\recyclerview-v7-21.0.0.aar拷贝出来,然后解压,重命名解压出来的目录中的class.jar文件为android-support-v7-recyclerview.jar,然后将此jar文件cp到工程项目的libs/下面,在jar包上面点击右键——> Build Path ——> Add to path .
* *** eclipse中只能使用21.0.0版本的RecycleView,否则容易报如下错误:
The type android.support.v4.view.ScrollingView cannot be resolved. It is indirectly referenced from required .class files