Amplify-js: Android resource linking failed

Created on 2 Apr 2019  路  11Comments  路  Source: aws-amplify/amplify-js

Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the
official AWS Amplify Console forum

Describe the bug
I have react-native 0.59.3 and aws-amplify/pushnotification ^1.0.20
When I generate release apk I have a error.

To Reproduce
Steps to reproduce the behavior:

  1. cd android
  2. ./gradlew assembleRelease
  3. See error
    node_modules/@aws-amplify/pushnotification/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.

node_modules/@aws-amplify/pushnotification/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.

node_modules/@aws-amplify/pushnotification/android/build/intermediates/res/merged/release/values/values.xml:2724: error: resource android:attr/fontVariationSettings not found.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.
Screen Shot 2019-04-02 at 10 49 31

Desktop (please complete the following information):

  • OS: Mac OS X Mojave 10.14.3

Additional context
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"

Build Push Notifications to-be-reproduced

Most helpful comment

try going to
YOUR_PROJECT/node_modules/@aws-amplify/pushnotification/android/build.gradle

edit compileSdkVersion, buildToolsVersion, and targetSdkVersion to

compileSdkVersion 28
buildToolsVersion "28.0.3"
targetSdkVersion 28

All 11 comments

have exactly the same issue with a similar configuration.

    "@aws-amplify/pushnotification": "^1.0.24",

```
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 18
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
}

```bash
Execution failed for task ':@aws-amplify_pushnotification:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
/node_modules/@aws-amplify/pushnotification/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
/node_modules/@aws-amplify/pushnotification/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
/node_modules/@aws-amplify/pushnotification/android/build/intermediates/res/merged/release/values/values.xml:2724: error: resource android:attr/fontVariationSettings not found.
/node_modules/@aws-amplify/pushnotification/android/build/intermediates/res/merged/release/values/values.xml:2725: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

How it could be fixed? Mb there is some workarounds

 react-native run-android --variant=release

what is basically ./gradlew app:installRelease
is working fine though...

as a workaround:

  • check if you have install the latest version of "amazon-cognito-identity-js"

Update:

add this to android/build.gradle

subprojects { afterEvaluate { project -> if (project.hasProperty("android")) { android { compileSdkVersion = 28 buildToolsVersion = "28.0.3" } } } }

try out! Worked for me.

try going to
YOUR_PROJECT/node_modules/@aws-amplify/pushnotification/android/build.gradle

edit compileSdkVersion, buildToolsVersion, and targetSdkVersion to

compileSdkVersion 28
buildToolsVersion "28.0.3"
targetSdkVersion 28

previous solution works to pass build/release, however, final apk will have lots of one-off crashes
@elorzafe can we label this again as a bug?

 FATAL EXCEPTION: main
 Process: com.app, PID: 23638
 java.lang.IllegalAccessError: com.amazonaws.amplify.pushnotification.RNPushNotificationMessagingService
        at dalvik.system.DexFile.defineClassNative(Native Method)
        at dalvik.system.DexFile.defineClass(DexFile.java:226)
        at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
        at dalvik.system.DexPathList.findClass(DexPathList.java:338)
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
        at android.app.ActivityThread.handleCreateService(ActivityThread.java:2859)
        at android.app.ActivityThread.-wrap4(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1427)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
    "@aws-amplify/pushnotification": "^1.0.27",
    "amazon-cognito-identity-js": "^3.0.12",
    "aws-amplify": "^1.1.28",
    "aws-amplify-react-native": "^2.1.12",
    "react": "16.8.3",
    "react-native": "0.59.8",

@mezalejandro Im going to close this issue as it seems the workaround was working correctly for people. Please reopen if you are still experiencing this issue

This is still not working @sammartinez none of the solutions suggested work

When running:
./gradlew assembleRelease

Screen Shot 2019-07-29 at 12 49 35 pm

@santialur here is happening the same as well

My solution:
subprojects { afterEvaluate {project -> if (project.hasProperty('android')){ android { compileSdkVersion 28 buildToolsVersion '28.0.3' } } } }

This is still not working guys, any solutions ?

facing the same issue, any help ??
RN: 0.62,
@aws-amplify/push_notifications: ^3.1..

Was this page helpful?
0 / 5 - 0 ratings