0

我开发了一个应用程序。它在除 2.3.x 版本之外的所有版本中都能正常工作。我已经在 2.3.6 和 2.3.3 版本的三星 Galaxy y 手机上进行了测试,但它无法在其中工作

这是我在 Manifest.xml 中使用的权限

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="me.radhakrishna.buddyreader"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.RECEIVE_SMS" />

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

    <supports-screens android:smallScreens="true"
                      android:normalScreens="true"
                      android:largeScreens="true"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="me.radhakrishna.buddyreader.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>
        <receiver android:name=".TextMessageReceiver">
            <intent-filter> 
                <action android:name="android.provider.Telephony.SMS_RECEIVED" /> 
            </intent-filter> 
        </receiver>
    </application>

</manifest>

我该如何解决这个问题,即使它在我上面在 Manifest.xml 中提到的所有 API 级别的模拟器中都能正常工作

错误日志

02-18 18:44:16.920: I/TextToSpeech.java(345): initTts() successfully bound to service
02-18 18:44:40.639: V/(345): 9866235007
02-18 18:44:40.639: I/TextToSpeech.java - speak(345): speak text of length 64
02-18 18:45:04.080: W/KeyCharacterMap(345): No keyboard for id 0
02-18 18:45:04.080: W/KeyCharacterMap(345): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
02-18 18:45:05.189: E/ActivityThread(345): Activity me.radhakrishna.buddyreader.MainActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$1@40520cf0 that was originally bound here
02-18 18:45:05.189: E/ActivityThread(345): android.app.ServiceConnectionLeaked: Activity me.radhakrishna.buddyreader.MainActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$1@40520cf0 that was originally bound here
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:938)
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:833)
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.ContextImpl.bindService(ContextImpl.java:867)
02-18 18:45:05.189: E/ActivityThread(345):  at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
02-18 18:45:05.189: E/ActivityThread(345):  at android.speech.tts.TextToSpeech.initTts(TextToSpeech.java:467)
02-18 18:45:05.189: E/ActivityThread(345):  at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:433)
02-18 18:45:05.189: E/ActivityThread(345):  at me.radhakrishna.buddyreader.MainActivity.onActivityResult(MainActivity.java:59)
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.Activity.dispatchActivityResult(Activity.java:3908)
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.ActivityThread.deliverResults(ActivityThread.java:2528)
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.ActivityThread.handleSendResult(ActivityThread.java:2574)
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.ActivityThread.access$2000(ActivityThread.java:117)
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:961)
02-18 18:45:05.189: E/ActivityThread(345):  at android.os.Handler.dispatchMessage(Handler.java:99)
02-18 18:45:05.189: E/ActivityThread(345):  at android.os.Looper.loop(Looper.java:123)
02-18 18:45:05.189: E/ActivityThread(345):  at android.app.ActivityThread.main(ActivityThread.java:3683)
02-18 18:45:05.189: E/ActivityThread(345):  at java.lang.reflect.Method.invokeNative(Native Method)
02-18 18:45:05.189: E/ActivityThread(345):  at java.lang.reflect.Method.invoke(Method.java:507)
02-18 18:45:05.189: E/ActivityThread(345):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-18 18:45:05.189: E/ActivityThread(345):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-18 18:45:05.189: E/ActivityThread(345):  at dalvik.system.NativeStart.main(Native Method)

请帮我。

4

1 回答 1

0

此行是问题的原因:

02-18 18:45:05.189: E/ActivityThread(345): Activity me.radhakrishna.buddyreader.MainActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$1@40520cf0 that was originally bound here
02-18 18:45:05.189: E/ActivityThread(345): android.app.ServiceConnectionLeaked: Activity me.radhakrishna.buddyreader.MainActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$1@40520cf0 that was originally bound
at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:938)

检查您的 MainActivity,此错误可能是由于误用静态类变量引起的。

于 2013-02-18T17:13:34.620 回答