Tuesday, 8 July 2014

Android Application Crash



I am working on an android application. It has been working perfectly fine until recently. Whenever I try to install the app via USB to run it on a device, it crashes on the splash screen. Also, when it crashes there are ads at the top of the screen, which I have never added programmatically. When I run the app on an emulator, it works. I thought there was a problem in my manifest but i dont see any problems. Since it doesnt go past the splash screen, here is my code. `



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);
}
}


}


Here is the manifest



<manifest xmlns:android="http://ift.tt/nIICcg"
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" />


This is what the logcat reads


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.


It prints that out about 30 times then it crashes.


No comments:

Post a Comment