voice icon indicating copy to clipboard operation
voice copied to clipboard

Could not find method compile() for arguments [directory 'libs']

Open Mgregchi opened this issue 6 months ago • 2 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Android gradle plugin: 8.8.2
Gradle: 8.13
[Incubating] Problems report is available at: file:///home/expo/workingdir/build/android/build/reports/problems/problems-report.html
FAILURE: Build failed with an exception.
* Where:
Build file '/home/expo/workingdir/build/node_modules/react-native-voice/android/build.gradle' line: 61
* What went wrong:
A problem occurred evaluating project ':react-native-voice'.
> Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-voice/android/build.gradle b/node_modules/react-native-voice/android/build.gradle
index c0484f8..813201f 100644
--- a/node_modules/react-native-voice/android/build.gradle
+++ b/node_modules/react-native-voice/android/build.gradle
@@ -58,7 +58,8 @@ allprojects {
 def supportVersion = rootProject.hasProperty('supportLibVersion') ? rootProject.supportLibVersion : DEFAULT_SUPPORT_LIB_VERSION
 
 dependencies {
-    compile fileTree(dir: 'libs', include: ['*.jar'])
+    // compile fileTree(dir: 'libs', include: ['*.jar'])
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
     testCompile 'junit:junit:4.12'
     compile 'com.android.support:appcompat-v7:${supportVersion}'
     compile 'com.facebook.react:react-native:+'

This issue body was partially generated by patch-package.

Mgregchi avatar Jul 16 '25 14:07 Mgregchi

dependencies {
    //compile fileTree(dir: 'libs', include: ['*.jar'])
	implementation fileTree(dir: 'libs', include: ['*.jar'])
    // testCompile 'junit:junit:4.12'
    // compile 'com.android.support:appcompat-v7:${supportVersion}'
    // compile 'com.facebook.react:react-native:+'
}

I ended up having to do this to get it to compile. Not sure if that will break the functionality, but I'm ok if I have a worse app on play store, so it's fine for my use case. Just changing that first compile line didn't fix it for me.

davidbfrogman avatar Aug 30 '25 15:08 davidbfrogman

dependencies {
    //compile fileTree(dir: 'libs', include: ['*.jar'])
	implementation fileTree(dir: 'libs', include: ['*.jar'])
    // testCompile 'junit:junit:4.12'
    // compile 'com.android.support:appcompat-v7:${supportVersion}'
    // compile 'com.facebook.react:react-native:+'
}

I ended up having to do this to get it to compile. Not sure if that will break the functionality, but I'm ok if I have a worse app on play store, so it's fine for my use case. Just changing that first compile line didn't fix it for me.

Well, at least you've forward

Mgregchi avatar Sep 10 '25 00:09 Mgregchi