kevinresol / react-native-sound-recorder

Simplest Sound Recorder for React Native
MIT License
119 stars 36 forks source link

Unable to create release build for Android #22

Closed abandisch closed 5 years ago

abandisch commented 5 years ago

I'm trying to build a release version of my app for Android using the command ./gradlew clean && ./gradlew assembleRelease under the android directory and it fails with the below error - can you advise what could be wrong?

> Task :react-native-sound-recorder:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-sound-recorder:verifyReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
  Output:  /.../node_modules/react-native-sound-recorder/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  /.../node_modules/react-native-sound-recorder/android/build/intermediates/res/merged/release/values-v28/values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
  /.../node_modules/react-native-sound-recorder/android/build/intermediates/res/merged/release/values/values.xml:957: error: resource android:attr/fontVariationSettings not found.
  /.../node_modules/react-native-sound-recorder/android/build/intermediates/res/merged/release/values/values.xml:958: error: resource android:attr/ttcIndex not found.
  error: failed linking references.
abandisch commented 5 years ago

Update Found the answer to my problem on this SO - essentially add the following to the projects build.gradle file to update the supported compileSdkVersion and buildToolsVersion:

subprojects { subproject ->
    afterEvaluate{
        if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}