我使用Android Studio 1.2创建了一个新项目,然后运行它,但它无法正常工作。错误如下:
com.example.android.lifecycle E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.android.lifecycle, PID: 8674
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.android.lifecycle/com.example.android.lifecycle.ActivityA}: java.lang.ClassNotFoundException: Didn't find class "com.example.android.lifecycle.ActivityA" on path: DexPathList[[zip file "/data/app/com.example.android.lifecycle-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2236)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5257)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
答案 0 :(得分:0)
gradle:1.3.0
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
我尝试了这些差异,发现当我将distributionUrl更改为2.4版本时,一切都很顺利。