为什么使用gradle-android-plugin构建的应用程序在设备上崩溃

时间:2013-01-21 09:25:09

标签: android eclipse groovy gradle

我已遵循this说明

gradle汇编工作,gradle eclipse工作,导入项目到Eclipse工作。

但是当我尝试在设备上运行它时,它会崩溃。

01-21 10:27:25.286: W/dalvikvm(9696): threadid=1: thread exiting with uncaught exception (group=0x413d4930)
01-21 10:27:25.286: E/AndroidRuntime(9696): FATAL EXCEPTION: main
01-21 10:27:25.286: E/AndroidRuntime(9696): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mockodu.gradletest/com.mockodu.gradletest.MyAndroidActivity}: java.lang.ClassNotFoundException: Didn't find class "com.mockodu.gradletest.MyAndroidActivity" on path: /data/app/com.mockodu.gradletest-2.apk
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.os.Looper.loop(Looper.java:137)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.app.ActivityThread.main(ActivityThread.java:5039)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at java.lang.reflect.Method.invokeNative(Native Method)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at java.lang.reflect.Method.invoke(Method.java:511)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at dalvik.system.NativeStart.main(Native Method)
01-21 10:27:25.286: E/AndroidRuntime(9696): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mockodu.gradletest.MyAndroidActivity" on path: /data/app/com.mockodu.gradletest-2.apk
01-21 10:27:25.286: E/AndroidRuntime(9696):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
01-21 10:27:25.286: E/AndroidRuntime(9696):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.mockodu.gradletest"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <activity android:name="MyAndroidActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

0 个答案:

没有答案