Android App-won';t在Nook启动,ClassNotFoundException
我已经向Nook开发者门户提交了一个应用程序。它在我的根nook颜色上运行良好,在所有不同的模拟器上以及play store上的数千台设备上运行良好。问题是,当我提交它时,它无法在他们的任何设备上启动。下面是我的清单和我的启动活动,它说这是由加载程序dalvik.system.PathClassLoader[/data/app/com.bfreq.dice-1.apk]中的java.lang.ClassNotFoundException:com.bfreq.dice.SplashScreen引起的 它没有找到我的主类还是没有找到SplashScreen加载的类Android App-won';t在Nook启动,ClassNotFoundException,android,classnotfoundexception,nook,Android,Classnotfoundexception,Nook,我已经向Nook开发者门户提交了一个应用程序。它在我的根nook颜色上运行良好,在所有不同的模拟器上以及play store上的数千台设备上运行良好。问题是,当我提交它时,它无法在他们的任何设备上启动。下面是我的清单和我的启动活动,它说这是由加载程序dalvik.system.PathClassLoader[/data/app/com.bfreq.dice-1.apk]中的java.lang.ClassNotFoundException:com.bfreq.dice.SplashScreen引起
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bfreq.dice"
android:installLocation="auto"
android:versionCode="11"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="11" />
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" />
<meta-data
android:name="ADMOB_ALLOW_LOCATION_FOR_ADS"
android:value="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="@drawable/icon"
android:label="@string/app_name" >
<activity
android:name=".SplashScreen"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ViewPagerMain"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock"
android:windowSoftInputMode="stateHidden" >
<intent-filter>
<action android:name="com.bfreq.dice.VPM" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".CustomDiceHandler"
android:label="@string/app_name"
android:windowSoftInputMode="stateHidden|adjustPan" >
<intent-filter>
<action android:name="com.bfreq.dice.CDH" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".AdProvider"
android:label="@string/app_name"
android:theme="@android:style/Theme.Wallpaper"
android:windowSoftInputMode="stateHidden|adjustPan" >
<intent-filter>
<action android:name="com.bfreq.dice.ADP" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >
</activity>
</application>
</manifest>
它持续了很长一段疯狂的时间…我不会在启动屏幕或任何其他活动中调用睡眠,这段代码有味道。试着改变一下。为什么不使用Handler.postDelayed()如果你长时间使用睡眠,你可能会得到一个ANR 很简单,只需执行以下操作
Runnable splashRunnable = new Runnable() {
@Override
public void run() {
Intent intent = new Intent("com.bfreq.dice.VPM");
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
}
在onCreate()方法中:
现在,你完成了
还要记住,try-catch块不应用于处理程序逻辑,它只应用于从问题中恢复。有时可能会有例外,但这种情况并不合适。您是否在Nook上运行ICS/JellyBean?我认为延迟后是一个好主意,但我并不确信这就是造成这种情况的原因。nook颜色正在运行,所以我必须把它作为系统apk,而不是他们安装它的方式。我试过nook hd(ics)模拟器,效果很好。谷歌做了几件事来让Android应用程序响应。其中一个例子是,试图在较旧的Android版本上执行网络操作会阻塞UI,但JellyBean崩溃。因此,在UI线程上调用sleep也可能违反性能。所以也许你应该试试这个。另外,让我试试Galaxy Nexus上的Thread.sleep()。好的,我试试postDelayed()。我以前从未使用过它,所以您能提供一些简单的代码吗?所以,使用post延迟和不使用意图过滤器,它可以通过测试!因此,如果我可以帮助的话,我不会使用等待线程。谢谢你的帮助!请阅读Ian G.Clifton的文章。
Files: Rejected: NOOK Color, NOOK Tablet, NOOK HD, NOOK HD+
Your app has failed to launch or crashed. Please see the log that is
attached for more information.
1. Install and boot the app.
Result: The app fails to boot and displays the message " Unfortunately,
D&D Dice by b.freq has stopped."
10-10 12:57:50.670 I/ActivityManager( 958): Starting activity: Intent {
act=android.intent.action.MAIN
dat=content://applications/applications/com.bfreq.dice/com.bfreq.dice.SplashScreen
flg=0x14000000
cmp=com.android.providers.applications/.ApplicationLauncher (has extras)
}
10-10 12:57:50.720 I/ApplicationLauncher( 3546): Launching
ComponentInfo{com.bfreq.dice/com.bfreq.dice.SplashScreen}
10-10 12:57:50.732 I/ActivityManager( 958): Starting activity: Intent {
act=android.intent.action.MAIN flg=0x10200000
cmp=com.bfreq.dice/.SplashScreen }
10-10 12:57:50.763 I/SurfaceFlinger( 958):
10-10 12:57:50.763 I/SurfaceFlinger( 958):
SurfaceFlinger::createSurface() : layer->mIdentity=244, LayerName=
Starting com.bfreq.dice
10-10 12:57:50.763 I/SurfaceFlinger( 958):
SurfaceFlinger::createSurface() : layer->clientIndex=1,
surfaceHandle->mToken=0x1
10-10 12:57:50.826 I/ActivityManager( 958): Start proc com.bfreq.dice
for activity com.bfreq.dice/.SplashScreen: pid=5006 uid=10051
gids={1015, 3003}
10-10 12:57:51.092 D/AndroidRuntime( 5006): Shutting down VM
10-10 12:57:51.092 W/dalvikvm( 5006): threadid=1: thread exiting with
uncaught exception (group=0x4001d888)
10-10 12:57:51.105 E/AndroidRuntime( 5006): FATAL EXCEPTION: main
10-10 12:57:51.105 E/AndroidRuntime( 5006): java.lang.RuntimeException:
Unable to instantiate activity
ComponentInfo{com.bfreq.dice/com.bfreq.dice.SplashScreen}:
java.lang.ClassNotFoundException: com.bfreq.dice.SplashScreen in loader
dalvik.system.PathClassLoader[/data/app/com.bfreq.dice-1.apk]
Runnable splashRunnable = new Runnable() {
@Override
public void run() {
Intent intent = new Intent("com.bfreq.dice.VPM");
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
}
new Handler().postDelayed(splashRunnable, SPLASH_DELAY);