Java.lang.classnotfoundException创建自定义键盘时

时间:2015-08-23 01:11:24

标签: java android

我想在android.I中创建一个自定义键盘,为此完成了以下教程: - http://code.tutsplus.com/tutorials/create-a-custom-keyboard-on-android--cms-22615

教程没有活动类唯一的服务类。当我运行代码时。它给了我classnotfound异常,如下所示: -

from decimal import Decimal
Tmax = Decimal(4.1)
......

我的主要文件如下: -

08-23 06:14:41.627: E/AndroidRuntime(645):  at android.app.ActivityThread.handleCreateService(ActivityThread.java:2570)
08-23 06:14:41.627: E/AndroidRuntime(645):  at android.app.ActivityThread.access$1800(ActivityThread.java:139)
08-23 06:14:41.627: E/AndroidRuntime(645):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
08-23 06:14:41.627: E/AndroidRuntime(645):  at android.os.Handler.dispatchMessage(Handler.java:102)
08-23 06:14:41.627: E/AndroidRuntime(645):  at android.os.Looper.loop(Looper.java:136)
08-23 06:14:41.627: E/AndroidRuntime(645):  at android.app.ActivityThread.main(ActivityThread.java:5086)
08-23 06:14:41.627: E/AndroidRuntime(645):  at java.lang.reflect.Method.invokeNative(Native Method)
08-23 06:14:41.627: E/AndroidRuntime(645):  at java.lang.reflect.Method.invoke(Method.java:515)
08-23 06:14:41.627: E/AndroidRuntime(645):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
08-23 06:14:41.627: E/AndroidRuntime(645):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
08-23 06:14:41.627: E/AndroidRuntime(645):  at dalvik.system.NativeStart.main(Native Method)
08-23 06:14:41.627: E/AndroidRuntime(645): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.kb.SimpleIME" on path: DexPathList[[zip file "/data/app/com.example.kb-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.kb-2, /vendor/lib, /system/lib]]
08-23 06:14:41.627: E/AndroidRuntime(645):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
08-23 06:14:41.627: E/AndroidRuntime(645):  at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
08-23 06:14:41.627: E/AndroidRuntime(645):  at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
08-23 06:14:41.627: E/AndroidRuntime(645):  at android.app.ActivityThread.handleCreateService(ActivityThread.java:2567)
08-23 06:14:41.627: E/AndroidRuntime(645):  ... 10 more

它只有一个java类,如下所示: -

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.kb"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="21" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <service
        android:name=".SimpleIME"
        android:label="@string/simple_ime"
        android:permission="android.permission.BIND_INPUT_METHOD" >
        <meta-data
            android:name="android.view.im"
            android:resource="@xml/method" />

        <intent-filter>
            <action android:name="android.view.InputMethod" />
        </intent-filter>
    </service>
</application>

我已经遍布整个地方,但没有找到解决方案。一个解决方案是使用mainfest声明名称(.SimpleIME)检查类名称(SimpleIME),这是相同的。请帮我解决这个问题。我找不到解决方案了。

0 个答案:

没有答案