新项目创建后的Android Studio错误

时间:2016-02-09 16:16:00

标签: java android gradle

我尝试为android创建一个简单的hello world应用程序。我创建了一个新的android项目,有空白活动,我看到的第一件事就是:

  

错误:(1,0)插件太旧,请更新到更新版本   版本,或将ANDROID_DAILY_OVERRIDE环境变量设置为   “df94d6841b68f9e80ddebea52ebc092b1d66cb93”修复插件版本和同步项目
打开   文件

我在将gradle包装器属性更改为https://services.gradle.org/distributions/gradle-2.11-all.zip之后修复了这个问题(之前是2.8)

然后我将com.android.tools.build:gradle:2.0.0-alpha2更改为beta2。

至少gradle sync工作,所以我决定运行该项目。它编译,将apk推送到我的设备,然后是这次崩溃:

  

引起:java.lang.ClassNotFoundException:没有找到类   路径上的“com.poketpixels.gcmfinal.MainActivity”:DexPathList [[zip文件]   “/data/app/com.poketpixels.gcmfinal-1/base.apk"],nativeLibraryDirectories=[/vendor/lib,   /系统/ lib中]]                                                                                 在   dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)                                                                                 at java.lang.ClassLoader.loadClass(ClassLoader.java:511)                                                                                 at java.lang.ClassLoader.loadClass(ClassLoader.java:469)                                                                                 在android.app.Instrumentation.newActivity(Instrumentation.java:1066)                                                                                 在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2259)                                                                                 在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2420)                                                                                 在android.app.ActivityThread.access $ 900(ActivityThread.java:154)                                                                                 在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1321)                                                                                 在android.os.Handler.dispatchMessage(Handler.java:102)                                                                                 在android.os.Looper.loop(Looper.java:135)                                                                                 在android.app.ActivityThread.main(ActivityThread.java:5294)                                                                                 at java.lang.reflect.Method.invoke(Native Method)                                                                                 在java.lang.reflect.Method.invoke(Method.java:372)                                                                                 在   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:904)                                                                                 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:699)                                                                                 抑制:java.lang.ClassNotFoundException:   com.poketpixels.gcmfinal.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个                                                                              引起:java.lang.NoClassDefFoundError:找不到使用的类   引导类加载器;没有可用的堆栈

  • 为什么在创建新内容后会出现gradle版本冲突        项目。

  • 为什么还会有应用崩溃?

1 个答案:

答案 0 :(得分:0)

首先在启动Android studio之前断开网络连接。在它启动后,您现在可以连接回网络并更新您的sdk。 然后喝一杯咖啡。