1

我已按照说明进行操作

gradle assemble 作品,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>
4

0 回答 0