sweatco / rn-scratch-card

React Native Scratch Card which temporarily hides content from user
MIT License
85 stars 13 forks source link

:rn-scratch-card:compileReleaseKotlin Build is failing due to this , any suggestions? #1

Open Amansaxena001 opened 2 years ago

avegrv commented 2 years ago

@Amansaxena001 Please provide more info for future investigation

Amansaxena001 commented 2 years ago

Task :rn-scratch-card:compileReleaseKotlin FAILED w: Runtime JAR files in the classpath have the version 1.3, which is older than the API version 1.5. Consider using the runtime of version 1.5, or pass '-api-version 1.3' explicitly to restrict the available APIs to the runtime of version 1.3. You can also pass '-language-version 1.3' instead, which will restrict not only the APIs to the specified version, but also the language features w: /Users/amansaxena/.gradle/caches/transforms-2/files-2.1/4500bbafdf53dca4f4031af27b416665/jetified-kotlin-stdlib-

Amansaxena001 commented 2 years ago

@avegrv try building the android app , ios builds are successfully but android there is some issue

sidvenu commented 2 years ago

Facing the same issue here

sidvenu commented 2 years ago

@Amansaxena001 seems like the issue is the React Native version. This was introduced in 0.65.0 (commit https://github.com/facebook/react-native/commit/2fbbdbb2ce897e8da3f471b08b93f167d566db1d), and I had an earlier RN version. You can try upgrading it as well.

gurshansingh commented 1 year ago
  1. go to rn-scratch-card in node_modules
  2. open build.gradle and change minSdkVersion 22 to 21
  3. than open gradle.properties and change RnScratchCard_kotlinVersion to your root project's kotlin version (to find kotlin version, go to android folder use ./gradlew -v for version )
Swarnim01 commented 1 year ago

@avegrv @gurshansingh Even after following the process, though the issue of kotlin is resolved but there is no interaction with the scratch cards , it is just placed like an image.

avegrv commented 1 year ago

@Swarnim01 Share your code please

Swarnim01 commented 1 year ago

@avegrv Resolved it , Placing it under <SafeAreaView> was causing trouble

markjornales commented 1 year ago

how to apply to expo project

avegrv commented 1 year ago

Closed this one. The solution you can find here https://github.com/sweatco/rn-scratch-card/issues/9 Later will do the fix.

jonlow commented 1 year ago

@avegrv is it possible to push the fix for this?

zilinailee commented 1 year ago

Hi, I'm still facing this issue with the below versions:

buildToolsVersion = "30.0.3" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31

"react-native": "~0.63.4" "rn-scratch-card": "^1.1.0"

Amansaxena001 commented 1 year ago

@zilinailee can you try with the mentioned steps

  1. go to rn-scratch-card in node_modules
  2. open build.gradle and change minSdkVersion 22 to 21
  3. Then open gradle.properties and change RnScratchCard_kotlinVersion to your root project's kotlin version (to find kotlin version, go to android folder use ./gradlew -v for version )
zilinailee commented 1 year ago

@zilinailee can you try with the mentioned steps

  1. go to rn-scratch-card in node_modules
  2. open build.gradle and change minSdkVersion 22 to 21
  3. Then open gradle.properties and change RnScratchCard_kotlinVersion to your root project's kotlin version (to find kotlin version, go to android folder use ./gradlew -v for version )

I had alrd tried this but I still get error WhatsApp Image 2023-06-14 at 09 23 01

Amansaxena001 commented 1 year ago

@zilinailee what i can see your build failed for app:installUatDebug which is the installation step. Can you attach full SS and also try the below steps.

  1. Delete node modules with package-lock.json
  2. yarn/npm i
  3. cd android
  4. ./gradlew clean
  5. cd ..
  6. npm run "your dev build command"
cristiansanm commented 10 months ago

Here's how I fixed this issue:

Previously, I was not abled to run the library into Android. I followed the instructions above, but I got no results.

Then I tried to manually linking the library and this is how it works for me:

First, you must search for your android project, something like /android/ and from there, you will change these files:

  1. On /android/settings.gradle add these lines, just after the previous packages:

include ':rn-scratch-card' project(':rn-scratch-card').projectDir = new File(rootProject.projectDir, '../node_modules/rn-scratch-card/android')

  1. On /android/app/build.gradle add this line inside dependencies {} object

implementation project(':rn-scratch-card')

After change all the lines, clean the libraries previously cached: cd android && cd ./gradlew clean && cd ..

Next, you must add manually to your MainApplication.java that should be into /android/app/src/main/java/com//MainApplication.java.

  1. On the import section, add import com.rnscratchcard.RnScratchCardPackage;
  2. Then, in the arrays of react packages (looks likereturn Arrays.<ReactPackage>asList(), add new RnScratchCardPackage(), with a coma before the new line and don't close the array with a coma since this is a java file.

If everything went well, you can now use your prefrered build command and the package should be listed and working.

PD: If the building doesn't have any problem, maybe you can't see the scratch: just imported again and it should work. PD2: I used Android Studio for checking the libraries with the autofilling, I recommend to use that just in case you want to be sure.

Hope this could be useful for anyone that is stucked with the lilbrary. Anyways, the autolinking is not working yet and sould be fixed. 👍🏽