我正在开发一个Android应用程序。直到最近,它一直运作良好。每当我尝试通过USB安装应用程序以在设备上运行它时,它会在启动画面上崩溃。此外,当它崩溃时,屏幕顶部有广告,我从未以编程方式添加。当我在模拟器上运行应用程序时,它可以工作。我觉得我的清单上有问题,但我没有看到任何问题。由于它没有通过启动画面,这是我的代码。 `
public class SplashActivity extends Activity {
private final int SPLASH_DISPLAY_LENGTH = 1000;
Info certificate;
DatabaseHandler db = new DatabaseHandler(this);
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(icicle);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.activity_splash);
Log.d("Reading: ", "Reading all info..");
List<Info> info = db.getAllInfo();
for (Info cn : info) {
String log = "Id: " + cn.getID() + " ,Label: " + cn.getLabel() + " ,Info: " + cn.getInfo();
// Writing Contacts to log
Log.i("Ids", "" + log);
}
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
String name = preferences.getString("Certificate","");
if(name.equals("Validated"))
{
splashActions("B"); /* Edit the value here*/
}
else
{
splashActions("A");
}
}
public void splashActions(String route)
{
if(route.equals("A")) {
/* New Handler to start the Menu-Activity
* and close this Splash-Screen after some seconds.*/
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
/* Create an Intent that will start the Menu-Activity. */
Intent mainIntent = new Intent(SplashActivity.this, IntroActivity.class);
SplashActivity.this.startActivity(mainIntent);
overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
SplashActivity.this.finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
if(route.equals("B"))
{
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
/* Create an Intent that will start the Menu-Activity. */
Intent mainIntent = new Intent(SplashActivity.this, UserProfile.class);
SplashActivity.this.startActivity(mainIntent);
overridePendingTransition(R.anim.abc_fade_in, R.anim.abc_fade_out);
SplashActivity.this.finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
}
}
这是清单
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.WallFly">
<supports-screens
android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:resizeable="true"
android:smallScreens="true"
android:xlargeScreens="true" >
</supports-screens>
<uses-sdk
android:anyDensity="true"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Actionbarstyle" >
<!-- Splash Screen Activity -->
<activity
android:name="com.android.WallFly.Intro.SplashActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Log In Activity -->
<activity
android:name="com.android.WallFly.Intro.IntroActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<!-- Create Account Activity -->
<activity
android:name="com.android.WallFly.Intro.CreateAccount"
android:label="@string/create_account"
android:parentActivityName="com.android.WallFly.Intro.IntroActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.CreateAccountActivity"
android:value="LoginActivity" />
</activity>
<!-- Sign In Activity -->
<activity
android:name="com.android.WallFly.Intro.SignIn"
android:label="@string/sign_in"
android:parentActivityName="com.android.WallFly.Intro.IntroActivity"
android:screenOrientation="portrait" >
</activity>
<!-- Main Activity -->
<activity
android:name="com.android.WallFly.Tabs.MainActivity"
android:icon="@drawable/wfn"
android:label="@string/empty"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.android.WallFly.Tabs.ComingSoon"
android:label="@string/title_activity_coming_soon"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.android.WallFly.Tabs.GrapeVine"
android:label="@string/title_activity_grape_vine"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.android.WallFly.Tabs.Notifications"
android:label="@string/title_activity_notifications"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.android.WallFly.Tabs.Explore"
android:label="@string/title_activity_explore"
android:screenOrientation="portrait" >
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAy3NwBUS3Bic73TeGvz5vdlwSmrxx4Np0" />
<activity
android:name="com.android.WallFly.Intro.CropperActivity"
android:label="@string/title_activity_cropper"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.android.WallFly.Profile.Profile"
android:label="@string/title_activity_profile" >
//android:screenOrientation="portrait"
</activity>
<activity
android:name="com.android.WallFly.Profile.UserProfile"
android:label="@string/title_activity_user_profile" >
</activity>
<activity
android:name="com.android.WallFly.WallFlyPictureCrop"
android:label="@string/title_activity_wall_fly_picture_crop" >
</activity>
<activity
android:name="com.android.WallFly.MapsActivity"
android:label="@string/title_activity_maps" >
</activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
这是logcat读取的内容
02-14 12:07:36.773: W/dalvikvm(2415): PR_CAPBSET_DROP 0 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
打印出来大约30次然后崩溃。