react-native-serialport
react-native-serialport copied to clipboard
Direct local .aar file dependencies are not supported when building an AAR.
I upgraded to react-native 0.64.2 (which included upgrading to gradle 6.7 and the android gradle plugin) and encountered this error
What went wrong: Execution failed for task ':react-native-serialport:bundleReleaseAar'.
Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :react-native-serialport project caused this error: .../node_modules/react-native-serialport/android/libs/usbserial-6.0.5-release.aar
I've been trying to make the change according to this article but I am out of my depth on gradle.
https://github.com/mikafi/react-native-serialport has solved the problem.
I just ran into same issue as you can see here, when I run ./gradlew assembleRelease, after adding react-native-serialport to my project:

How did you resolve it, @dougbradbury ?
"react-native-serialport": "^1.3.1" "react-native": "0.65.1"
com.android.tools.build:gradle:4.2.1
resolved this with app:assembleRelease instead of assembleRelease
resolved this with app:assembleRelease instead of assembleRelease
@jankoJelic , I am using app:assembleRelease for building the app but am still facing the same issue. do you mind sharing how exactly you solved this issue? I've tried to find a solution online and most of them are suggesting adding some settings on build.gradle file and none of them is working.
error details: Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error). The following direct local .aar file dependencies of the :react-native-serialport project caused this error: C:....\wimiti\node_modules\react-native-serialport\android\libs\usbserial-6.0.5-release.aar
Did you guys manage to get a solution for this issue? still facing this issue. I am using "react-native-serialport": "^1.3.1"
After a couple of days of trying to find a solution online, none of them worked. I have come up with a solution for this issue, just follow 4 simple steps:
-
Copy libs folder from yourProject/node_modules/react-native-serialport/android and then paste it into yourProject/android/app
-
From yourProject/node_modules/react-native-serialport/android/build.gradle
Under dependencies, change this line:
implementation fileTree(dir: 'libs', include: ['usbserial-6.0.5-release.aar'])
to compileOnly fileTree(dir: 'libs', include: ['usbserial-6.0.5-release.aar'])
-
Make sure that you have made the necessary configurations for building a signed APK. More details on the official site
-
Now build your project by: cd android then run ./gradlew clean assembleRelease
Now, you should be able to build your project.