BlinkID / blinkid-react-native

ID scanning for cross-platform apps built with ReactNative.
175 stars 59 forks source link

[Android] AAPT: error: resource android:attr/lStar while building release apk #203

Closed dragorwyin closed 1 year ago

dragorwyin commented 1 year ago

Hello, I have following error after trying to build the Android app:

> Task :blinkid-react-native:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':blinkid-react-native:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:C:\{pathname}\node_modules\blinkid-react-native\src\android\build\intermediates\merged_res\release\values\values.xml:3001: AAPT: error: resource android:attr/lStar not found.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

also in some other cases while trying to reach out any solutions I have following error:

> Task :blinkid-react-native:verifyReleaseResources FAILED

> Task :app:stripStagingReleaseDebugSymbols
Execution optimizations have been disabled for task ':app:stripStagingReleaseDebugSymbols' to ensure correctness due to the following reasons:
  - Gradle detected a problem with the following location: 'C:\Users\a833098\projects\ws-carrier-web-mobile\android\app\build\intermediates\merged_native_libs\stagingRelease\out'. Reason: Task ':app:stripStagingReleaseDebugSymbols' uses this output of task ':app:copyDevReleaseBundledJs' without declaring an explicit or implicit dependency. This can lead 
to incorrect results being produced, depending on what order the tasks are executed. Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
  - Gradle detected a problem with the following location: 'C:\Users\a833098\projects\ws-carrier-web-mobile\android\app\build\intermediates\merged_native_libs\stagingRelease\out'. Reason: Task ':app:stripStagingReleaseDebugSymbols' uses this output of task ':app:copyStagingReleaseBundledJs' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. 
Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#implicit_dependency for more details about this problem.
Unable to strip the following libraries, packaging them as they are: libBlinkID.so, libbutter.so, libc++_shared.so, libfabricjni.so, libfb.so, libfbjni.so, libfolly_futures.so, libfolly_json.so, libglog.so, libglog_init.so, libimagepipeline.so, libjsc.so, libjscexecutor.so, libjsi.so, libjsijniprofiler.so, libjsinspector.so, liblogger.so, libmapbufferjni.so, libnative-filters.so, libnative-imagetranscoder.so, libreact_codegen_rncore.so, libreact_config.so, libreact_debug.so, libreact_nativemodule_core.so, libreact_render_animations.so, libreact_render_attributedstring.so, libreact_render_componentregistry.so, libreact_render_core.so, libreact_render_debug.so, libreact_render_graphics.so, libreact_render_imagemanager.so, libreact_render_leakchecker.so, libreact_render_mapbuffer.so, libreact_render_mounting.so, libreact_render_runtimescheduler.so, libreact_render_scheduler.so, libreact_render_telemetry.so, libreact_render_templateprocessor.so, libreact_render_textlayoutmanager.so, libreact_render_uimanager.so, libreact_utils.so, libreactnativeblob.so, libreactnativejni.so, libreactnativeutilsjni.so, libreactperfloggerjni.so, librrc_image.so, librrc_root.so, librrc_text.so, librrc_unimplementedview.so, librrc_view.so, libruntimeexecutor.so, libtool-checker.so, libturbomodulejsijni.so, libyoga.so.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':blinkid-react-native:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:C:\Users\a833098\projects\ws-carrier-web-mobile\node_modules\blinkid-react-native\src\android\build\intermediates\merged_res\release\values\values.xml:3001: AAPT: error: resource android:attr/lStar not found.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

I tried to follow all solutions from: https://stackoverflow.com/questions/69033022/message-error-resource-androidattr-lstar-not-found

I would like to mention I had a ticket here: https://github.com/BlinkID/blinkid-react-native/issues/200 but this ticket was resolved only for debug veersion of app.

My app settings: compileSdkVersion 31 minSdkVersion 23 targetSdkVersion 31

Packages versions: React-native: 0.68.1 React: 17.0.2 blinkid-react-native: 5.17.0

But nothing helped. It helped only with "debug" release. I need some assistance with this problem. Thank you.

@edit I can see I'm able to build the release apk directly from Android Studio, but it's not working for this command line: gradlew --build-file=build.gradle assembleRelease

dragorwyin commented 1 year ago

I added following things in android/build.gradle:

buildscript {
    ext {
        buildToolsVersion = '31.0.0'
        minSdkVersion = 24
   }
}
allprojects {
    configurations.all {
        resolutionStrategy {
            force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
            force 'androidx.core:core-ktx:1.6.0'
            force 'androidx.appcompat:appcompat:1.2.0'
            force 'androidx.core:core-ktx:1.6.0'
        }
    }

    repositories {
        exclusiveContent {
            filter {
                includeGroup "com.facebook.react"
            }
            forRepository {
                maven {
                    url "$rootDir/../node_modules/react-native/android"
                }
            }
        }
}

and in android/app/build.gradle following dependencies:

    implementation 'androidx.appcompat:appcompat:1.2.0'

    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

After building app with Android Studio, command is working also. I will reopen this ticket if any issues will occur still.