Handling DropBox with different Build Variant - android

I'm facing an issue with dropbox in my 2 apps.
in fact I have 2 build variants and to be able to handle different secrets for both apps I use Gradle to inject the value into the manifest but for dropbox, i always have this error
The installation did not succeed.
The application could not be installed: INSTALL_FAILED_CONFLICTING_PROVIDER
what I did is I added in the manifest dropboxAppKey in the scheme attribute
<activity
android:name="com.dropbox.core.android.AuthActivity"
android:configChanges="orientation|keyboard"
android:launchMode="singleTask"
>
<intent-filter>
<data android:scheme="db-${dropboxAppKey}" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
and in Gradle i inject the app key corresponding to each flavor
App1 {
manifestPlaceholders = [dropboxAppKey : "123456"]
}
App2 {
manifestPlaceholders = [dropboxAppKey : "654321"]
}
but I got always the same error INSTALL_FAILED_CONFLICTING_PROVIDER

It sounds like you need a distinct app key for each variant (so, a total of 4 app keys in this case; 2 per app) in order to disambiguate each app variant.
Open a Dropbox API ticket from the account that owns the apps and we can add an extra app key/secret to each of your apps:
https://www.dropbox.com/developers/contact
That way, you can use a distinct key in each variant.

Related

Android app link not working in android 12 always opening in browser

I have hosted assetlinks file into our domain https://ourdomain/.well-known/assetlinks.json And also verified this using https://developers.google.com/digital-asset-links/tools/generator and from android studio's App Links Assitant and got verified status from both the ways.
But when i am sharing debug APK for testing it's always opening in browser.
I also tried uploading on app store and downloaded from there for testing but it always open in browser.
Note: for debug build used my laptop SHA-256 and once app live on play store changed SHA ( got SHA-256from By going to Application Dashboard in Play Console then Release Management --> App Signing ) on hosted assetlinks file into our domain https://ourdomain/.well-known/assetlinks.json
Below is the code used in the manifest file.
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="abc.test.com" />
</intent-filter>
Deep-links are working in Android 11 or before but on Android 12 it isn't.
But even after adding assetlinks.json file and adding all the intent-filters. Android 12 still isn't detecting deep-links. In Android-Manifest file turns out that scheme's tag is need to be separated from the data tag like this:
// OLD - Which is only working Android 11 or before
<data
android:host="domain.name"
android:pathPrefix="/videos"
android:scheme="https" />
// NEW - Which is working on all including Android 12
<data android:scheme="https" />
<data
android:host="domain.name"
android:pathPrefix="/videos" />
You need to add deep link verification.
See https://doordash.engineering/2022/01/25/your-deep-links-might-be-broken-web-intents-and-android-12/
I have same problem and solved by going to app info setting -> set as default ->support web addresses and you will see your short link
so turn it on and it will work ;)
Update:
as every one said its not a programmatically way so the best way is that link below said
In my case, the app is working in android 11, but it doesn't work in android 12 when the app is compiled and built with android studio.
I tested the production app; it works fine with the app link.
For development build, I have to go to App info -> Open by default -> Add link -> check off all the available links
This seems only happen with development builds; the apps installed from Google app store automatically has all the links selected.
In my case problem was with inconsistent between SHA Signatures in store build and https://ourdomain/.well-known/assetlinks.json, that's why deep links were disabled by default on Android 12, for fixing it we can connect our phone with problem build to Android studio and run this command:
adb shell pm get-app-links com.your_app_package_name
as a result you should see something like this:
com.your_app_package_name:
ID: .....
Signatures: [AB:CD:EF:HI:GK...]
Domain verification state:
your_domain.com legacy_failure
next you need to check whether the signature fingerprints is included in your https://ourdomain/.well-known/assetlinks.json, in my case it doesn't,
also keep in mind that in assetlinks.json file can be couple of signatures for example for debug, alpha, beta and production builds, it should looks like below:
[
{
"relation": ["delegate_permission/common.handle_all_urls"],
"target": {
"namespace": "android_app",
"package_name": "com.your_app_package_name",
"sha256_cert_fingerprints" :["DE:BU:GS:HA:25:6...","PR:OD:SH:A:25:6..."]
}
}
]
After adding assetlinks.json in domain you have to reinstall app (just uninstall the app and install again) that will work
This fixed it for me:
<intent-filter
android:autoVerify="true"
>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:host="my.page.link" />
<data android:scheme="https" />
</intent-filter>
Notice: android:autoVerify="true"
The weird thing about this is only broke on certain Android phones, and wasn't necessarily consistent across API versions. Pixel 4 on API 33 worked fine without this fix and didn't work with Pixel 6 on API 33. What can ya do.
In my case after doing the above (debug/release SHA-256 keys in assetlinks, separate the scheme tag) the final culprit turned out to be the "path" tag. For some reason the verification process does not include the tag even though this has always been there in the app and used to work prior to Android 12. Not a big deal in my app since I was ignoring the path anyway.
Before (not working):
<data android:host="dl.example.com"
android:path="/test" />
<data android:scheme="https" />
After (working):
<data android:host="dl.example.com"/>
<data android:scheme="https"/>
Hope it helps someone
Follow these steps:
Step 1:
Add android:autoVerify="true" to your intents-filter.
Step 2:
Move the android:scheme to separate data tag
So now your intents-filter in manifest looks like this:
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="websiteUrl"
android:pathPrefix="/" />
<data
android:scheme="https" />
<!-- note that the leading "/" is required for pathPrefix-->
</intent-filter>
Step 3:
Add your Digital Asset Links JSON file to following url:
https://{yourdomain.name}/.well-known/assetlinks.json
Note:- For production app make sure you use the digital asset links JSON file generated by Play console. You can find it at
Play console -> Your App -> Setup (Side menu option) -> App Integrity -> App signing (scroll to the bottom)
Step 4:
Verify that all the steps are correctly implemented by manually running app link validation using these commands - https://developer.android.com/training/app-links/verify-android-applinks#manual-verification
Step 5:
If your links were shown as verified in step 4 then now install the app on device and wait for atleast 2-3 minutes before clicking on any app links because in this time Android will verify your app links by reading your manifest file and the digital assets JSON file that you uploaded on your website.
After you have waited 2-3 minutes, now you can click on your app link and it should open your app.
Hope this helps!
Before Android 12, Deep link followed the standard implementation with the code in the Manifest:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="www.yourdomain.dev"
android:pathPrefix="/set/v1" />
After Android 12, we have to add autoVerify to the intent-filter:
<intent-filter android:autoVerify="true" tools:targetApi="m">
And the website must be verified by adding assetlinks.json to the .well-known directory in your website (same as Apple does)
But, most important, you can only test this building and signing the app:
Build -> Generate Signed Bundle/APK
during development, you can test your implementation manually enabling the link in the app on your device

Play Store won't allow installing both flavors of my app

I am getting "Can't install " dialog when trying to install from Play Store while the other flavor is already installed.
I have two flavors: free and paid. Both have different applicationIds like so:
free {
applicationId "aaa.bbb.ccc.free"
}
paid {
applicationId "aaa.bbb.ccc.paid"
}
I can't install Free if Paid is installed and vice-versa.
In the code I essentially use the main-flavor for the paid version and add advertisment stuff in the free flavor.
FreeActivity1 inherits Activity1 and
FreeActivity2 inherits from Activity2
My main manifest (used in paid flavor):
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="aaa.bbb.ccc"
android:sharedUserId="aaa.bbb.ccc">
...
<application ...>
<activity
android:name=".Activity1">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity-alias
android:name="${applicationId}.act1"
android:targetActivity=".Activity1"/>
<activity
android:name=".ddd.Activity2"/>
<activity-alias
android:name="${applicationId}.act2"
android:targetActivity=".ddd.Activity2"/>
</application>
and my free manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="aaa.bbb.ccc"
android:sharedUserId="aaa.bbb.ccc">
<application tools:ignore="GoogleAppIndexingWarning">
<activity
android:name=".FreeActivity1">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity-alias
tools:replace="android:targetActivity"
android:name="${applicationId}.act1"
android:targetActivity=".FreeActivity1"/>
<activity
tools:node="remove"
android:name=".Activity1"
/>
<activity
android:name=".ddd.FreeActivity2"/>
<activity-alias
tools:replace="android:targetActivity"
android:name="${applicationId}.act2"
android:targetActivity=".ddd.FreeActivity2"/>
<activity
tools:node="remove"
android:name=".ddd.Activity2"
/>
...
</application>
I have 2 Apps in the Play Console and released just fine but one of my features is migrating the user settings from the free to the paid version. As it is, I just cannot install both on the same device via Google Play. It works fine with apk install.
Tangentially related maybe(?): I have two google accounts with Play Store access. On one of those accounts, Play Store tells me, my Pro version is not compatible with my device (Same device I use on other account). I use the same features/permissions (internet) for free and paid.
Help would be greatly appreciated! Thanks in advance!
EDIT:
I have debugged the playstore installation with logcat. I get the following error:
Error -505 while installing aaa.bbb.ccc.free: INSTALL_FAILED_SHARED_USER_INCOMPATIBLE: Package couldn't be installed in /data/app/aaa.bbb.ccc.freeXXXXXXXXXXXX: Package aaa.bbb.ccc.free has no signatures that match those in shared user aaa.bbb.ccc; ignoring!
Looks like your package name is the same in your manifest for both paid and free. Try changing it there.
Ok this is actually a pretty bad problem:
I used sharedUserId and Google App Signing together. This is just not possible (see edit in op) and there are 0 warnings in the Play Console.
Since the automatic signing process always generates a new key for each App in the Store, those signatures will not match but Play Store requires them to if they have the same sharedUserId.
Either I remove all features requiring the sharedUserId or I unpublish both my apps and create two new versions with different applicationId and use manual signing.

Launching the app directly on clicking deep-link

I'm using branch.io in my project for deep-linking. On click of the deep-link, the app is not getting launched directly instead it's showing the list of apps. Then I need to click my app in order to open it. I'm testing on Oreo(API level 27) device. Below is a piece of manifest code.
<intent-filter
android:autoVerify="true"
tools:targetApi="m">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="xxx-alternate.app.link"
android:scheme="https" />
<data
android:host="xxx.test-app.link"
android:scheme="https" />
<data
android:host="xxx.app.link"
android:scheme="https" />
</intent-filter>
There are a few things to ensure for a deeplink to directly open your app:
The intent-filter for the App link has the autoverify option set to true (which I see is set in your case)
The SHA-256 key you have uploaded on the Branch dashboard is the same SHA-256 key that is used to sign your APK file. (Make sure if you are testing against a debug build to use the SHA-256 key from the debug keystore)
If correctly setup, the app link should correctly open your app. This behavior was updated since Android API level 23 and above.
You can check if the link domain is correctly linked to your application here. On entering the details and clicking Test Statement it should state "Success! Host <your domain> grants app deep linking to <App Package Name>" if correctly linked.
PS: If you update your SHA-256 key on Branch dashboard, it might take a few hours for Google to scrap the asset-link file hosted by Branch.

Android Studio expands Activity name in AndroidManifest.xml

I upgraded my project from Eclipse to Android Studio.
Everything is working, including different flavors (in Eclipse I had an ANT script that auto-generated the sourcecode for the different flavors).
I can also generate the different signed APK's. And these all work on the device.
Also uploading these APK's to GooglePlay is no problem.
User also get these updates, but after the update they need to re-create the shortcut to the app on the home screen. The old shortcut is removed.
I believe this is due to the fact that "Android Studio" modifies stuff in the AndroidManifest.xml when generating the APK.
In Eclipse source, in Android studio source and when I inspect the Eclipse generated APK I have the following (with the name being .StartUpActivity) :
<activity android:name=".StartUpActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
However, when I look into the generated apk from Android Studio this is modified to :
<activity android:name="be.abc.android.StartUpActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
So the name has been changed from .StartUpActivity to be.abc.android.StartUpActivity.
In the end, this is the same path but I believe the shortcut just looks at the name .StartUpActivity, and decides it is no longer available and removes the shortcut....
Can I fix this in someway that the shortcuts don't get deleted. Or that Android Studio doesn't mess with the shortened package names in the AndroidManifest.xml ?
Indeed, as soon as you modify the launcher manifest entry, the shortcut has to be recreated. To avoid such issue, you can make use of activity-alias. A step-by-step guide can be found here.

Android Instant App is uploaded but can not be roll out

UPDATE: 20170703
Using Android Studio 3.0 Canary 5
Modified some AndroidManifest and build.gradle files,
Moved from inside to inside for both Base's AndroidManifest and App's AndroidManifest, like below:
<application ...>
<meta-data android:name="asset_statements" android:resource="#string/asset_statements" />
<activity ...>
</application>
resource asset_statements:
<string name="asset_statements">[{\n \"relation\": [\"delegate_permission/common.handle_all_urls\"],\n \"target\": {\n \"namespace\": \"web\",\n \"site\": \"https://example.com\",\n }\n}]</string>
The web verification is passed successfully (see screenshot below), uploaded new APK and ZIP (Instant App) but still same problem of can't rollout the Instant App.
Contacted google playstore support through "live chat", promised will get back but still no response after a few days.
------ OLD POST BELOW -------
I am using Android Studio 3.0 Canary 4 (preview).
Both Installable APK and Instant App (zip) are already uploaded successfully.
The Installable APK is already rolled out.
The Digital Assets Link json file already uploaded and verified in https://example.com/.well-known/assetlinks.json
I have only 1 Base module (feature module), inside the Base's AndroidManifest have only 1 activity:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="#style/AppTheme"
>
<activity
android:name="com.example.test.app.base.activity.MainActivity"
android:configChanges="locale|layoutDirection|orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data
android:name="default-url"
android:value="https://example.com/instantapp/.*" />
<meta-data
android:name="asset_statements"
android:resource="#string/asset_statements" />
<intent-filter android:order="1" android:autoVerify="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="http" />
<data android:scheme="https" />
<data android:host="example.com" />
<data android:pathPattern="/instantapp/.*"/>
</intent-filter>
</activity>
</application>
My assets_statements define in /res/string.xml :
<string name="asset_statements" translatable="false">
[{
\"include\": \"https://example.com/.well-known/assetlinks.json\"
}]
</string>
So currently I believed every thing should be working fine because any configuration problem will be filtered when upload in Google Playstore, currently I can not rollout my Instant App because error :
Errors
Resolve these errors before starting the rollout of this release.
Your site 'mysite.com' has not been linked through the Digital Assets Link protocol to your app. Please link your site through the Digital Assets Link protocol to your app.
Warnings
Check these warnings before starting the rollout of this release.
NOTE: example.com is only to replace my real domain.
Please help me to understand what is wrong and how to solve it ?
If you are using Google Play App Signing then your local keystore contains the Upload Key, which is different than the App Signing Key.
In that case, the SHA256 fingerprint obtained with keytool is not the one you should include the Digital Assets Link json file.
The correct SHA256 fingerprint can be obtained in the Google Play Console, under Release Management / App Signing / App signing certificate.
Play Console Screenshot
You need to use path pattern in your deep link:
Make sure you are using your actual domain instead of example.com
https://example.com/instantapp

Categories

Resources