diff --git a/packages/amazon-cognito-identity-js/android/build.gradle b/packages/amazon-cognito-identity-js/android/build.gradle
index 5a84247911b..a12ec2d84b2 100644
--- a/packages/amazon-cognito-identity-js/android/build.gradle
+++ b/packages/amazon-cognito-identity-js/android/build.gradle
@@ -1,3 +1,8 @@
+import com.android.Version
+
+def agpVersion = Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
+def androidManifestPath = agpVersion >= 7 ? 'src/main/AndroidManifest.xml' : 'src/hasNamespace/AndroidManifest.xml'
+
buildscript {
repositories {
mavenCentral()
@@ -15,6 +20,10 @@ def safeExtGet(prop, fallback) {
}
android {
+ if (agpVersion >= 7) {
+ namespace "com.amazonaws"
+ }
+
compileSdkVersion safeExtGet('compileSdkVersion', 26)
buildToolsVersion safeExtGet('buildToolsVersion', '26.0.3')
@@ -24,6 +33,11 @@ android {
versionCode 1
versionName "1.0"
}
+ sourceSets {
+ main {
+ manifest.srcFile androidManifestPath
+ }
+ }
lintOptions {
abortOnError false
}
diff --git a/packages/amazon-cognito-identity-js/android/src/hasNamespace/AndroidManifest.xml b/packages/amazon-cognito-identity-js/android/src/hasNamespace/AndroidManifest.xml
new file mode 100644
index 00000000000..e43d2fb535d
--- /dev/null
+++ b/packages/amazon-cognito-identity-js/android/src/hasNamespace/AndroidManifest.xml
@@ -0,0 +1,4 @@
+
+
+
diff --git a/packages/amazon-cognito-identity-js/android/src/main/AndroidManifest.xml b/packages/amazon-cognito-identity-js/android/src/main/AndroidManifest.xml
index e43d2fb535d..0a0938ae37e 100644
--- a/packages/amazon-cognito-identity-js/android/src/main/AndroidManifest.xml
+++ b/packages/amazon-cognito-identity-js/android/src/main/AndroidManifest.xml
@@ -1,4 +1,3 @@
-
+
diff --git a/packages/rtn-push-notification/android/build.gradle b/packages/rtn-push-notification/android/build.gradle
index cdfccef39c0..3a523c66611 100644
--- a/packages/rtn-push-notification/android/build.gradle
+++ b/packages/rtn-push-notification/android/build.gradle
@@ -1,3 +1,8 @@
+import com.android.Version
+
+def agpVersion = Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
+def androidManifestPath = agpVersion >= 7 ? 'src/main/AndroidManifest.xml' : 'src/hasNamespace/AndroidManifest.xml'
+
buildscript {
def kotlin_version = rootProject.ext.has('kotlinVersion')
? rootProject.ext.get('kotlinVersion')
@@ -26,6 +31,10 @@ def getExtOrDefault(prop) {
}
android {
+ if (agpVersion >= 7) {
+ namespace 'com.amazonaws.amplify.rtnpushnotification'
+ }
+
compileSdkVersion getExtOrDefault('compileSdkVersion')
defaultConfig {
@@ -33,6 +42,12 @@ android {
targetSdkVersion getExtOrDefault('targetSdkVersion')
}
+ sourceSets {
+ main {
+ manifest.srcFile androidManifestPath
+ }
+ }
+
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
diff --git a/packages/rtn-push-notification/android/src/hasNamespace/AndroidManifest.xml b/packages/rtn-push-notification/android/src/hasNamespace/AndroidManifest.xml
new file mode 100644
index 00000000000..19e60ecad16
--- /dev/null
+++ b/packages/rtn-push-notification/android/src/hasNamespace/AndroidManifest.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/rtn-push-notification/android/src/main/AndroidManifest.xml b/packages/rtn-push-notification/android/src/main/AndroidManifest.xml
index 19e60ecad16..7a7f8084c69 100644
--- a/packages/rtn-push-notification/android/src/main/AndroidManifest.xml
+++ b/packages/rtn-push-notification/android/src/main/AndroidManifest.xml
@@ -1,6 +1,5 @@
-
+