android app doesnt crash after installiation - java

So I have very weird problem with android app that I developed that I really do not understand how to address.
Description of the problem: When I run the app in my emulator(and many other emulators) the app works perfectly, but when I list it on Google Play and some user download the app, it automatically crashes. so I just wonder if my androidmainfest is properly written.
*the program written in esclipse, java, android.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app"
android:versionCode="6"
android:versionName="1.5" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="com.example.MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.SurfaceExampleView"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="com.example.start" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.RulesGame"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.rules" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.PolicyGame"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.policy" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.RevenueGame"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.revenue" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.example.ShopGame"
android:label="#string/app_name" >
<intent-filter>
<action android:name="com.example.shop" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="#android:style/Theme.Translucent"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>

You have posted only your manifest and not the logs. My guesses based on that is the problem may be within your package declaration, rest everything seems fine.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app".....
The package should be unique and its like what we call package in java world. You have declared it as com.app whereas your app is using com.example.... package. Also com.app maybe used by other app.The package name defines your application's identity.
Once you publish your application, you cannot change the package name. As the package name defines your application's identity, so if you change it, then it is considered to be a different application and users of the previous version cannot update to the new version. So you may have to upload another app with different package name.
Try getting logs(use crashlytics) for your crash and we can look into it for the root cause.

Related

I have warning "App is not indexable by Google Search; consider adding at least one Activity with an ACTION-VIEW intent filter. "

After the update, the following warning appeared in the studio:
“App is not indexable by Google Search; consider adding ACTION-VIEW intent filter. See issue explanation for more details. more ... (Ctrl + F1) »
How to fix it?
My Api is 28.
Here is my manifests:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.omen.serverforcofe" >
<uses-permission android:name="android.permission.NFC"/>
<uses-feature android:name="android.hardware.nfc" android:required="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
>
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain"
/>
</intent-filter>
</activity>
</application>
</manifest>
<activity
android:name=".MyActivity"
android:screenOrientation="portrait"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
Adding this intent filter to one of the activities declared in app manifest fixed this for me.

Why is my app icon showing as blank from the app grid list with android studio?

I have tried a many different links on here to figure out why my app will not show on the list of app when I download it, but I have had no luck. I have tried many different things. Is there something I am missing with getting Intent Filters set up in android studio?
<application
android:name=".GdpApp"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/AppThemeNoActionBarOrangeMain">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
<activity
android:name=".SplashActivity"
android:screenOrientation="landscape"
android:theme="#style/AppThemeNoActionBarSplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
'''
Not 100% sure but it does seem strange that you have 2
"android.intent.action.MAIN"

Unable to find Default Activity Class Name

I am working the process of linking facebook login to my android application. In some tutorial I was asked to register my app with Facebook Developers website where I did everything but I couldnt find "Default Activity Class Name" in my Android Studio I have provided this below manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.evago.evago">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<!-- Front Page -->
<activity
android:name=".Frontpage"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
<!-- Search results activity -->
<activity
android:name=".SearchResultsActivity"
android:label="#string/title_activity_searchable"
android:launchMode="singleTop"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
</activity>
<!-- Search results activity Ends -->
</application>
Please help me in locating the "Default Activity Class Name"
should be the class containing:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
So its .Frontpage
Frontpage - This is the default activity name because its the launcher activity

Android - Java - Have app run when device boots up

I am having a bit of an issue here, my code seems right, but its not doing what I am expecting it too.
I have an app and I would like to run when the device boots up. But when the device boots up, it application does not run, which is what I am expecting.
First in my Manifest, I added the uses-permission for RECEIVE_BOOT_COMPLETED:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Then also in my Manifest I added a receiver and activity inside the application:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".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=".BootReceiver"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<activity
android:name=".BootReceiver"
android:label="#string/title_activity_boot_receiver" >
</activity>
</application>
And then I created a BootReceiver Activity that looks like this:
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BootReceiver extends BroadcastReceiver{
#Override
public void onReceive(Context context, Intent intent) {
Intent i = new Intent(context, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
}
When I install the app, boot the device, the app does not run right when the device boots up.
I do not understand what I am doing wrong here. Is my code wrong? Anyone got any ideas?
BootReceiver is not your Activity it is class which extends broadcast receiver.
update your manifest, this will be enough
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<activity
android:name=".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=".BootReceiver"
android:enabled="true"
>
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
/>
</intent-filter>
</receiver>
</application>
Step #1: Get rid of <activity android:name=".BootReceiver" ..., as you do not have an Activity named BootReceiver.
Step #2: Get rid of <category android:name="android.intent.category.DEFAULT" />, as categories are not usually used on broadcasts, and definitely is not used here.
Step #3: Get rid of android:permission="android.permission.RECEIVE_BOOT_COMPLETED", as that indicates that the sender of the broadcast must hold that permission, which may not be true.
You will be looking to have a manifest that looks more like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.commonsware.android.sysevents.boot"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="11"/>
<supports-screens
android:largeScreens="false"
android:normalScreens="true"
android:smallScreens="false"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name">
<receiver android:name=".OnBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<activity
android:name="BootstrapActivity"
android:theme="#android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
(from this sample app)
That's strange 'cause all you mentioned with Manifest and code seems good...
So do you mean no MainActivity is running after Boot?
BTW I used this in my Manifest and works fine:
<receiver
android:name="com.example.BootMeUp"
android:enabled="true"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
Try this: This code works for me....
<receiver
android:name="your.package.name.BootReceiver"
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

Android-Installing to device using eclipse install two instance of same app at once-error

Android-Installing to device using eclipse install two instance of same app at once-error
and it runs when just after installed using the eclipse but when I touch the once of the icon its not starting it shows me the android common error syaing unexpectedly stopped!! please help me??
This is the manifest I'm using(activities)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.hunter99x"
android:icon="#drawable/icon"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".main" android:configChanges="orientation|keyboardHidden" android:theme="#android:style/Theme.NoTitleBar"
android:label="#string/app_name" android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".origine" android:configChanges="orientation|keyboardHidden" android:theme="#android:style/Theme.NoTitleBar"
android:label="#string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.origine" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity `enter code here`android:name=".Gameover" android:configChanges="orientation|keyboardHidden" android:theme="#android:style/Theme.NoTitleBar"
android:label="#string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LandingScreen" android:configChanges="orientation|keyboardHidden" android:theme="#android:style/Theme.NoTitleBar"
android:label="#string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-permission android:name="android.permission.VIBRATE"/>
</manifest>
I think the issue is because you have repeated
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
this for 2 activities. Try removing this and declare just 1 acivity as your main. Tjis may solve your issue.
Try this code inside the activities and check if it works:
#Override
public void onBackPressed() {
finish();
System.exit(0);
}

Categories