android app force closing in release mode - android

I have finished developing an Android app. I'm using android studio. Everything is working fine when I normally run the app in debug mode on my device. Not even an exception.
But when I followed Google's guidelines on creating the signed release version of my app and installed it in my device, the app is force closing as soon as I launch it.
I just can't figure out a way to locate what the problem is. I created the release version using the "Generate signed apk" option in the Android studio IDE. Then I copied it in my device and installed the app. And then when I run, it just stops working immediately.
I don't know what more info should I give here because I just can't infer the cause of this issue.
Please help. What can be the possible reasons behind such problems.? And how can I find them?
EDIT:
Everytime I unlock the device, it is displaying the dialog "MyApp has stopped working". There's nothing in the logcat. I have no idea why this might be happening. My app uses these permissions:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission
android:name="com.mypackagename.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.mypackagename.permission.C2D_MESSAGE" />

I solved the issue on my own.
First of all, you can use a tool named "monitor", present in the android sdk tools to debug your release version. This tool shows everything that happens in your device.
I used the tool and found out that the problem occurred because I had enabled proguard in my app and forgot to add rules for third party libraries used in my app.
So all those who might be facing this problem, check your proguard file and make sure you've added the required rules for all third party libraries as well.

Related

"release declaring sensitive permissions" error when added new version that doesn't have sensitive permissions

Im getting this error when Im adding apk to alpha and beta in play store.
Production is normal.
I found this answers.
Google play console said "You can't edit this app until you create a new app release declaring sensitive permissions" how to fix it?
Warnings Your Apk Is Using Permissions That Require A Privacy Policy: (android.permission.READ_PHONE_STATE)
Neither Im using read_phone_state permission nor sms,call log permissions
I have attached screen shot my google play store account below.
I cant see where the real problem is. This page says only just there is an error.
Thats my all permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.READ_SYNC_STATS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="android.permission.READ_LOGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
In our case, we were thinking that we did not have "Read SMS/Call log" permissions in our app yet, and had the same error. But we were planning to include such features into our app, so we sumbitted the sensitive permissions declaration form previously via Google Forms link (before it was integrated into Play Console) and got a decline.
So our solution was:
1. Add READ_SMS permission to our apk and increase version code
2. Publish new apk in alpha channel and declare that the release did not comply with the new regulations (in the permission declaration form). After this the error went away.
3. Publish updated APK with this permission removed (which was our goal in the first place)
After step 2 the error went away, so we were able to release our planned apk to production.
Update:
It turned out we had an old apk with "Read SMS" permission in our alpha channel. So you can use these instructions to trigger declaration form, but you will still need to delete this apk later in order to comply new rules. This is what we did, after that error went away.
I solved it by following these steps,
Create a release and instead of uploading new apk/bundle select anyone from the library which has SMS or call permissions.
Fill up all the necessary details and the declaration form, save and review.
Now go to release management and edit this release and upload the new apk/bundle which you were supposed to upload.
Now you wont see any error messages.
Fill in all the details, save,review and rollout.
Do you have an alpha or beta release? Check If those releases have sensitive permissions, then release to production.
We were seeing this error even though our current release doesn't use these permissions because we had released an old version that did to an internal test track. We deactivated all previous APKs and the error was resolved.
You are declaring the permissions which are necessary that application ask during run time, according to the android policy you have to declare them before uploading the APK, in your case you took that permission i.e camera, record audio. Here you can get more help.
As to this article all apps that not meet the new policy and not remove or grant this permissions with google via declaration : https://docs.google.com/forms/d/e/1FAIpQLSfCnRaa4b1VuHhE4gVekWJc_V0Zt4XiTlsKsTipTlPg5ECA7Q/closedform may be removed from google play store and not be able to update currently existing one.
From your manifest permissions list you can see you asking for sms and phone related permissions : READ_CONTACTS, CALL_PHONE
Please see the following instructions to submit the declaration form:
A1. Go to the Console > App release > Click ‘Create a release’ > Upload a new APK that you want to release
A2. Retain the current version of APK
A3. Click ‘Add from library’ > Upload all active APKs to cover all permissions across the tracks in your app
You can find active APK in Release management > Artifact library
A4. Fill out the Permissions Declaration Form for extension
‘Compliance status’ > check “No, this release does not meet the SMS and Call log”
‘Declarations’ > check all
A5. Click "Save" at the bottom of the page
After that, please stay on the same page and follow the next steps:
B1. Deactivate and remove ONLY the old APKs which you do not want to release.
B2. Click "Save" again then select "Review"
B3. Then, you'll be able to release a new version of APK by clicking "Start Roll Out" button.
After finished all the steps, if your APK does NOT have sensitive or high-risk permissions anymore, please skip the steps below(C1~4) and no additional action is required. However, if you uploaded the new APK with sensitive or high-risk permissions, please note that your app will be removed after Mar 9, 2019.
If your new APK has sensitive or high-risk permissions & you want to utilize the permission after Mar 9, you need to finish the additional step to submit the declaration form to enable further review.
C1. After the new APK release(Step B1~3), please go to the Console > App release > Click ‘Create a release’
C2. Click ‘Add from library’ > Select the APK(which will be utilized after Mar.9)
C3. Retain newly updated APK in step B3
C4. Fill out Permissions Declaration Form (not for extension),
‘Compliance status’ > check “Yes, this release meets the SMS and Call log”
Choose core functionalities as well
C5. Submit the form by Clicking “Save” at the bottom of the page
Also, to make sure your app be safe after Mar 9, please do not forget to update all the APKs(with sensitive or high-risk permission) in other track with the same steps.

how to resolve google play warning regarding "Use of SMS or Call Log permission groups"

I have removed sms and call log permissions from my app and using alternatives to common uses that is using share intent and dial intent. But I am still getting the same warning in the play console on my application. following is the list of permissions in my app.
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_SETTINGS"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- Push Notification Permission -->
<uses-permission android:name="com.onwaycab.permission.C2D_MESSAGE" />
<uses-permission
android:name="com.google.android.c2dm.permission.RECEIVE"/>
<!-- MAP Permission -->
<permission
android:name="com.onwaycab.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="com.onwaycab.permission.MAPS_RECEIVE" />
Edit:
I am receiving the warning even if I have not used sms and call log permission so it is not duplicate of that question.
If you are seeing this alert every time you refresh the page, then one or more your libraries might be using the permission.
To check all permissions your app is using, just install the app on the real device and check the App Info - Permissions.
Alternatively, add this to your Manifest file. tools:node="remove" will remove the permission in case if any library is requesting it.
<uses-permission android:name="android.permission.READ_CALL_LOG" tools:node="remove" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" tools:node="remove" />
Another important point, if you are using build variant then define it inside your highest priority manifest file.
Library manifest: lowest Priority
Main manifest: Medium Priority
Build Vairant manifest : Highest priority
My playstore console showed this "SMS & CALL_LOGS" related warning.
So, I removed the SMS & CALL_LOGS related permissions from the manifest and uploaded the latest release build to playstore. But the warning was still shown to me after latest build was published on store.
So ,After this I filled this below Permissions declaration form and the warning is removed now.
https://docs.google.com/forms/d/e/1FAIpQLSfCnRaa4b1VuHhE4gVekWJc_V0Zt4XiTlsKsTipTlPg5ECA7Q/viewform
Another thing worth checking - we had an old Beta version of the app that did use SMS in the Google Play Console on Release management -> App release.
The Beta wasn't active any more but that old version was still showing under Release management -> Artifact library-> Active artifacts, so am guessing Google still considered it an active application. Helpfully this area also shows you all the permissions your app uses, in case you are concerned if a library or plugin is adding permissions without your knowledge.
Removing the Beta version and appealing the removal as it being due to an inactive Beta, got the app republished within a few hours.

Bug in android studio 2.2.x?

it was trying to build a newer version of a watchface. Android Studio upgraded to Version 2.2.
Since that, I have the problem, that the handheld-APK doesn't seem to have the wear-APK inside. If I install it via the play store (as a beta-release), I can see the app, which is for configuration, but the watchface is not pushed to the watch.
If I build the wear-APK alone, it is about 3 MB, the handheld one about 3.2 MB.
I googled a lot but only found one similar article here, but without a solution, only that it might be a bug in AS.
My watchface doesn't have a Activity, as I only use the service.
Can anyone help? Thanks!
This is what is in the wear-manifest:
<uses-feature android:name="android.hardware.type.watch" />
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
and this in the mobile-manifest:
<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />

Android studio Adds extra permissions to my app

I have an app which makes use of wifi permissions only but ever since I moved to android studio, the compiled apk of my app uses two more extra permissions, that is phone calls/phone id and SD read/write.
I have no idea how and why those permissions have been added to my app but many users complain about that.
My app uses google analytics from google play services and appcompat. I also make use of this line
deviceId = Secure.getString(ctx.getContentResolver(), Secure.ANDROID_ID);
Any ideas? I don't want those extra permissions they scare my users away
Here is the content of manifest file
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="com.android.vending.BILLING" />
Studio is adding permissions appropriate to the classes / features that you are using in your project.
Update
Here is a related question that focuses on manifest merging config

Why am I requesting "Device ID & call information" permission on Android?

Testing my Android app (made in Unity) on the live store shows that it requests "Device ID & call information". As far as I can tell, I don't request these permissions. Here are the permissions I request in my AndroidManifest.xml file. Is this a permission required for all apps? Or is it hidden under one of these other permissions?
<uses-permission android:name="com.android.vending.BILLING" />
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Thanks!
I just spent an absurd amount of time trying to resolve this so figured I would share with anyone out there going through a similar agony.
Removing the permissions from your manifest will not necessarily remove them from the final build. Unity auto-detects required permissions from all included libraries. The libraries which are most likely causing you to have this permission included are from the Facebook sdk.
If you want to keep the Facebook sdk in the build, there's a relatively straightforward solution. Remove the Facebook SDK (completely) and install a version <= 7.80. For whatever reason, the changes to the sdk in 7.9+ prompt Unity to auto-include the READ_PHONE_STATE permission which triggers the Device ID & Call Information permission warning in google play.

Categories

Resources