vision-camera-code-scanner icon indicating copy to clipboard operation
vision-camera-code-scanner copied to clipboard

values.xml:2761: AAPT: error: resource android:attr/lStar not found.

Open valery-lavrik opened this issue 3 years ago • 13 comments

when building an application with the command ./gradlew assembleRelease an error has appeared.

ERROR: ...\node_modules\vision-camera-code-scanner\android\build\intermediates\merged_res\release\values\values.xml:2761: AAPT: error: resource android:attr/lStar not found.

I use the most up-to-date versions of all packages

    "react": "18.1.0",
    "react-native": "0.70.5",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-reanimated": "^2.12.0",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-vision-camera": "^2.15.2",
    "vision-camera-code-scanner": "^0.2.0"

valery-lavrik avatar Nov 09 '22 12:11 valery-lavrik

image

valery-lavrik avatar Nov 09 '22 12:11 valery-lavrik

lStar in core-1.7.0, some resource have been deleted,but those ones can be used in core-1.6.0,for these show AAPT: error: resource android:attr/lStar not found gradle build task failed tip, maybe we can try add following code in build.gradle dependencies:

implementation("androidx.core:core:1.6.0") {
    force = true
}
implementation("androidx.core:core-ktx:1.6.0") {
    force = true
}

anyway, it works for me.

ismjt avatar Nov 10 '22 08:11 ismjt

it didn't help me :(

valery-lavrik avatar Nov 10 '22 12:11 valery-lavrik

I had the same issue for building with targetSdkVersion 33: this approach worked for me: In build.gradle (project) I added SDK values to builscript -> ext

buildscript { ... ext { ... VisionCameraCodeScanner_compileSdkVersion = 33 VisionCameraCodeScanner_minSdkVersion = 21 VisionCameraCodeScanner_targetSdkVersion = 33 } ... }

to override default compile and target SDK version. I hope it would help.

AliBaseghiVirtudev avatar Nov 11 '22 11:11 AliBaseghiVirtudev

thank you, it helped!

valery-lavrik avatar Nov 11 '22 13:11 valery-lavrik

@AliBaseghiVirtudev answer worked on my RN 0.70.6, I was getting this when i was using,

    compileSdkVersion = 33
    targetSdkVersion = 33

this ⬆ in my project lavel build.gradle file, I have changed them to Version "31" now everything is working fine.

Below is my entire project level build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        //   compileSdkVersion = 31
        //   targetSdkVersion = 31

        /*
        compileSdkVersion = 33
        targetSdkVersion = 33
        */

        compileSdkVersion = 31
        targetSdkVersion = 31

        VisionCameraCodeScanner_compileSdkVersion = 33
        VisionCameraCodeScanner_minSdkVersion = 21
        VisionCameraCodeScanner_targetSdkVersion = 33
/*
        androidXCore = "1.6.0"

*/

        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.2.2")
//        classpath("com.android.tools.build:gradle:7.2.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:5.0.1")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }
        google()
        maven { url 'https://www.jitpack.io' }
    }
}

sultanularefin avatar Dec 21 '22 04:12 sultanularefin

I had the same issue for building with targetSdkVersion 33: this approach worked for me: In build.gradle (project) I added SDK values to builscript -> ext

buildscript { ... ext { ... VisionCameraCodeScanner_compileSdkVersion = 33 VisionCameraCodeScanner_minSdkVersion = 21 VisionCameraCodeScanner_targetSdkVersion = 33 } ... }

to override default compile and target SDK version. I hope it would help.

lifesaver!

kaivamannam avatar Jan 12 '23 05:01 kaivamannam

I had the same issue for building with targetSdkVersion 33: this approach worked for me: In build.gradle (project) I added SDK values to builscript -> ext

buildscript { ... ext { ... VisionCameraCodeScanner_compileSdkVersion = 33 VisionCameraCodeScanner_minSdkVersion = 21 VisionCameraCodeScanner_targetSdkVersion = 33 } ... }

to override default compile and target SDK version. I hope it would help.

it worked for me, thanks!

JeffPatricio avatar Jan 12 '23 19:01 JeffPatricio

@AliBaseghiVirtudev answer worked on my RN 0.70.6, I was getting this when i was using,

    compileSdkVersion = 33
    targetSdkVersion = 33

this ⬆ in my project lavel build.gradle file, I have changed them to Version "31" now everything is working fine.

Below is my entire project level build.gradle file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        //   compileSdkVersion = 31
        //   targetSdkVersion = 31

        /*
        compileSdkVersion = 33
        targetSdkVersion = 33
        */

        compileSdkVersion = 31
        targetSdkVersion = 31

        VisionCameraCodeScanner_compileSdkVersion = 33
        VisionCameraCodeScanner_minSdkVersion = 21
        VisionCameraCodeScanner_targetSdkVersion = 33
/*
        androidXCore = "1.6.0"

*/

        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
            ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
            ndkVersion = "21.4.7075529"
        }
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.2.2")
//        classpath("com.android.tools.build:gradle:7.2.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:5.0.1")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }
        mavenCentral {
            // We don't want to fetch react-native from Maven Central as there are
            // older versions over there.
            content {
                excludeGroup "com.facebook.react"
            }
        }
        google()
        maven { url 'https://www.jitpack.io' }
    }
}

it will work for flutter?

wasihDev avatar Mar 07 '23 14:03 wasihDev

I just fixed this issue by replace ./gradlew assembleRelease by ./gradlew app:assembleRelease

faizkhan7896 avatar Jul 10 '23 09:07 faizkhan7896

I just fixed this issue by replace ./gradlew assembleRelease by ./gradlew app:assembleRelease

This worked.

Pekstaar avatar Aug 06 '23 09:08 Pekstaar

I just fixed this issue by replace ./gradlew assembleRelease by ./gradlew app:assembleRelease

Why does this work?

CholoTook avatar Sep 05 '23 12:09 CholoTook

I just fixed this issue by replace ./gradlew assembleRelease by ./gradlew app:assembleRelease Why does this work?

lrnrzg avatar Sep 14 '23 07:09 lrnrzg