I am changing the current android project, so it can be installed on the same device for several options and build configs.
build.gradle:
{
defaultConfig {
applicationId "com.myapp"
manifestPlaceholders = [
manifestApplicationId: "${applicationId}",
onesignal_app_id: "xxxx",
onesignal_google_project_number: "xxxx"
]
}
productFlavors {
production {
applicationId "com.myapp"
}
dev {
applicationId "com.myapp.dev"
}
}
buildTypes {
release {
}
debug {
applicationIdSuffix ".debug"
}
}
}
AndroidManifest.xml
<manifest ... >
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" />
<permission
android:name="${applicationId}.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<receiver
android:name="com.onesignal.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
</manifest>
When I compile both versions of debugging and releasing the same flavor, I received an error message:
...
INSTALL_FAILED_DUPLICATE_PERMISSION
waving = com.myapp.permission.C2D_MESSAGE
PKG = com.myapp.dev
...
manifestApplicationId placeholder appeared from AndroidManifest.xml in the OneSignal library, as indicated at https://documentation.onesignal.com/docs/android-sdk-setup
Does anyone know how to solve this problem? Thank.
source
share