我尝试从此GIT中心链接https://github.com/yandex-money/yandex-money-sdk-android启动程序示例。我用Eclipse。 但是当它开始运行时,会出现一个错误:其中一个错误 - 无法实例化活动ComponentInfo java.lang.ClassNotFoundException。 下面的logcat:
W/dalvikvm(4201): threadid=1: thread exiting with uncaught exception (group=0x40af49f0)
E/AndroidRuntime(4201): FATAL EXCEPTION: main
E/AndroidRuntime(4201): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{ru.yandex.money.android.sample/ru.yandex.money.android.sample.MainActivity}: java.lang.ClassNotFoundException: ru.yandex.money.android.sample.MainActivity
E/AndroidRuntime(4201): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
E/AndroidRuntime(4201): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
E/AndroidRuntime(4201): at android.app.ActivityThread.access$600(ActivityThread.java:123)
E/AndroidRuntime(4201): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
E/AndroidRuntime(4201): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(4201): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(4201): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(4201): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(4201): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(4201): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
E/AndroidRuntime(4201): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
E/AndroidRuntime(4201): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(4201): Caused by: java.lang.ClassNotFoundException: ru.yandex.money.android.sample.MainActivity
E/AndroidRuntime(4201): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
E/AndroidRuntime(4201): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime(4201): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime(4201): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
E/AndroidRuntime(4201): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
E/AndroidRuntime(4201): ... 11 more
这是我的清单文件的内容:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ru.yandex.money.android.sample" >
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="ru.yandex.money.android.sample.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="ru.yandex.money.android.sample.PayActivity"/>
</application>
</manifest
&GT;
从主要代码我改变了两件事:我已经将android版本从2.1更改为3.0,在styles.xml文件中我已经将字符串<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
替换为<style name="AppTheme" parent="android:Theme.Holo">
。
错误的原因在哪里?