iyegoroff / react-native-image-filter-kit

Various image filters for iOS & Android
MIT License
317 stars 42 forks source link

Execution failed for task ':react-native-image-filter-kit:compileDebugJavaWithJavac'. #146

Open hashhirr opened 9 months ago

hashhirr commented 9 months ago

For ios it works fine but when i try to compile it on android it produces this error: (i am using gradle version 8.5, react-native version 0.73.0.)

Task :react-native-image-filter-kit:processDebugManifest package="iyegoroff.imagefilterkit" found in source AndroidManifest.xml: /Users/thunderbirds/Desktop/dummyapp2/node_modules/react-native-image-filter-kit/android/src/main/AndroidManifest.xml. Setting the namespace via the package attribute in the source AndroidManifest.xml is no longer supported, and the value is ignored. Recommendation: remove package="iyegoroff.imagefilterkit" from the source AndroidManifest.xml: /Users/thunderbirds/Desktop/dummyapp2/node_modules/react-native-image-filter-kit/android/src/main/AndroidManifest.xml.

Task :react-native-image-filter-kit:compileDebugJavaWithJavac FAILED 46 actionable tasks: 13 executed, 33 up-to-date

kamalDevk commented 8 months ago

Hello, I was facing the same error, after did more analysis i found a solution and this works form me. and i was facing this issue on Mac m2 chip.

"react": "18.2.0", "react-native": "0.72.6",

I add these line on main build.gradle file not in app/build.gradle file.

Inside the buildscript section

` ext { buildToolsVersion = "33.0.0" minSdkVersion = 23 compileSdkVersion = 33 targetSdkVersion = 33 kotlin_version = '1.8.0'

// I add these lines

     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"
    }
}

`

hashhirr commented 8 months ago

Hello, I was facing the same error, after did more analysis i found a solution and this works form me. and i was facing this issue on Mac m2 chip.

"react": "18.2.0", "react-native": "0.72.6",

I add these line on main build.gradle file not in app/build.gradle file.

Inside the buildscript section

` ext { buildToolsVersion = "33.0.0" minSdkVersion = 23 compileSdkVersion = 33 targetSdkVersion = 33 kotlin_version = '1.8.0'

// I add these lines

     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"
    }
}

`

i tried it but still same error.! but then i attempted in android studio then i got different error of renderScript

kamalDevk commented 8 months ago

I had find the link, then i download them and check configuration files.

this code is working i run this code on my machine. ( i found the solution from this link )

A. please check this link maybe you found something.

https://github.com/divyeshgohil85/RNImageFilter

B. Some time it give me error while generating the build by Android studio so i follow these steps and it works for me.

` ------- Execution failed for task ':react-native-image-filter-kit:compileReleaseRenderscript'. --------------

i am using nvm so i switch node version 18 because my react-native project version is > 70

open terminal from your project directory switch on node 18

1. open Android studio using this  `open -a "Android studio.app"`
2. Invalidate the caches by android studio

**After that run these commands inside your VS code.**
 Go inside project directory/android folder   then run this command

    ./gradlew clean  
3. After successful this command run next command
    ./gradlew assembleRelease

4. try to run your project from android studio.

`

Robogram commented 7 months ago

I have urgent project that is using this library to apply filters to image.

I had find the link, then i download them and check configuration files.

this code is working i run this code on my machine. ( i found the solution from this link )

A. please check this link maybe you found something.

https://github.com/divyeshgohil85/RNImageFilter

B. Some time it give me error while generating the build by Android studio so i follow these steps and it works for me.

` ------- Execution failed for task ':react-native-image-filter-kit:compileReleaseRenderscript'. --------------

i am using nvm so i switch node version 18 because my react-native project version is > 70

open terminal from your project directory switch on node 18

1. open Android studio using this  `open -a "Android studio.app"`
2. Invalidate the caches by android studio

**After that run these commands inside your VS code.**
 Go inside project directory/android folder   then run this command

    ./gradlew clean  
3. After successful this command run next command
    ./gradlew assembleRelease

4. try to run your project from android studio.

`

Is https://github.com/divyeshgohil85/RNImageFilter alternative?

ya-watanabe commented 6 months ago

Hello, I was facing the same error, after did more analysis i found a solution and this works form me. and i was facing this issue on Mac m2 chip. "react": "18.2.0", "react-native": "0.72.6", I add these line on main build.gradle file not in app/build.gradle file. Inside the buildscript section ` ext { buildToolsVersion = "33.0.0" minSdkVersion = 23 compileSdkVersion = 33 targetSdkVersion = 33 kotlin_version = '1.8.0' // I add these lines

     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"
    }
}

`

i tried it but still same error.! but then i attempted in android studio then i got different error of renderScript

I am having the same problem as above.

 error: cannot find symbol
    final ScriptC_DifferenceBlend script = new ScriptC_DifferenceBlend(ctx.getScript());
          ^
  symbol:   class ScriptC_DifferenceBlend
  location: class DifferenceBlendPostProcessor

I use following versions and M2 mac.

# package.json
    "react-native": "0.73.2",
     "react-native-image-filter-kit": "^0.8.0",

# gradle-wrapper.properties
 distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip

I've tried change renderscriptTargetApi and renderscriptSupportModeEnabled, but nothing changed. Is there anyone who has solved this problem?

ya-watanabe commented 6 months ago

I've found that new RN0.72.0 project with react-native-image-filter-kit can complete build. but 0.73.0 can not :(

ya-watanabe commented 6 months ago

After careful verification, I found that the version of the gradle plugin was affected.

diff --git a/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml b/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml
index f2a1d2e..51c1ce1 100644
--- a/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml
+++ b/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml
@@ -1,5 +1,5 @@
 [versions]
-agp = "8.1.1"
+agp = "7.4.2"
 gson = "2.8.9"
 guava = "31.0.1-jre"
 javapoet = "1.13.0"

This patch solved issue in mycase.

However, I'm afraid that it may be affected again in future updates.

P.S. https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes android.defaults.buildfeatures.renderscript default values had changed and it affects.

santimone commented 6 months ago

After careful verification, I found that the version of the gradle plugin was affected.

diff --git a/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml b/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml
index f2a1d2e..51c1ce1 100644
--- a/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml
+++ b/node_modules/@react-native/gradle-plugin/gradle/libs.versions.toml
@@ -1,5 +1,5 @@
 [versions]
-agp = "8.1.1"
+agp = "7.4.2"
 gson = "2.8.9"
 guava = "31.0.1-jre"
 javapoet = "1.13.0"

This patch solved issue in mycase.

However, I'm afraid that it may be affected again in future updates.

P.S. https://developer.android.com/build/releases/past-releases/agp-8-0-0-release-notes android.defaults.buildfeatures.renderscript default values had changed and it affects.

Thanks, worked for me! <3

dbarbosapn commented 5 months ago

Adding android.defaults.buildfeatures.renderscript=true To the gradle.properties file fixes this issue, as a temporary solution.

This will be removed on the next Gradle major version (v9), so it would be better to bump the gradle version on this library and enabling renderscript on the project itself with android { buildFeatures { renderScript true } } On the app-level build.gradle file.

I'd be happy to contribute to bumping this but I'm struggling to build the project locally 😞

@iyegoroff would appreciate your help on this 👍