Closed slobglob closed 2 years ago
It looks like we'd need to create AAR files in addition to JAR files for this to work: https://stackoverflow.com/questions/50279346/android-app-bundle-build-fails/50355398 It would add complexity to the build system and probably create hassle for users that are interested in portability to other platforms than Android... In any case, if you're interested in upgrading the build to support the creation of AAR files, please do, contributions are welcome!
I have the same issue.
I am Author of cv_bridge_javacv library,
and I use android javacv arm / arm64 versions.
Can you make AAR files only for android?
@talregev Yes, it's possible. Contributions are welcome!
I'm running into a similar issue: File 'root/lib/arm64-v8a/ffmpeg' uses reserved file or directory name 'lib'.
Has there been any updates to address this?
BTW, in case anyone is wondering, we can exclude those files from the build. They are not necessary at runtime.
I'm a new to Android development. Can you explain how to exclude them from build. I'm unable to figure it out. Thanks!
On Tue, Nov 12, 2019, 1:04 PM Samuel Audet notifications@github.com wrote:
BTW, in case anyone is wondering, we can exclude those files from the build. They are not necessary at runtime.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bytedeco/javacv/issues/1117?email_source=notifications&email_token=AJWWA5SPW2TAYU7U5UW2LTTQTJL7RA5CNFSM4GMV5WA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDZJ4XA#issuecomment-552771164, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWWA5WTUOHRZFFO3HM3KC3QTJL7RANCNFSM4GMV5WAQ .
@akash2018xD There's some examples of that in issue #353.
@saudet Excluding file solved the problem, but what does this library do? Don't we need it at all? Thanks
@lisichka999 No, it should be made more modular, see issue #1071.
I get a similar error:
File 'root/lib/x86_64/include/opencv2/shape/shape_distance.hpp' uses reserved file or directory name 'lib'.
with javacv included in my kotlin project
implementation "org.bytedeco:javacv:1.5.3"
implementation "org.bytedeco:opencv-platform:4.3.0-1.5.3"
But I'm unable to fix it by excluding the files as shown above. I tried the example given above
packagingOptions {
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/ffmpeg/pom.xml'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
}
Which obviously did not work because I use opencv-platform not javacpp-presets. So I adjusted the paths to what I think should be right
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
pickFirst 'META-INF/maven/org.bytedeco/opencv-platform/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco/opencv-platform/pom.xml'
}
But the error persists. Any ideas?
@phillies You'll need to exclude all the files from lib/x86_64/include
, etc.
@saudet How can we exclude all the files from lib/x86_64/include
exactly? The link you provided above which you said to have some examples for exclusion seems to point to what @phillies had. I can't find any details on excluding .h
files.
I tried exclude '**/lib/arm64-v8a/include/*'
which didn't help. More specically:
android {
...
packagingOptions {
exclude '**/lib/arm64-v8a/include/*'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.properties'
pickFirst 'META-INF/maven/org.bytedeco.javacpp-presets/opencv/pom.xml'
}
}
dependencies {
implementation "org.bytedeco:javacv:1.4.1"
implementation "org.bytedeco.javacpp-presets:opencv:3.4.1-1.4.1"
implementation "org.bytedeco.javacpp-presets:opencv:3.4.1-1.4.1:android-arm"
implementation "org.bytedeco.javacpp-presets:opencv:3.4.1-1.4.1:android-arm64"
implementation "org.bytedeco.javacpp-presets:opencv:3.4.1-1.4.1:android-x86"
...
}
(my error message was File 'root/lib/arm64-v8a/include/cvkernels.h' uses reserved file or directory name 'lib'.
hence arm64-v8a
in the path)
Something like this I guess: https://github.com/bytedeco/javacv/issues/1329#issuecomment-720758804
Thanks for the super quick response, @saudet!
Neither exclude 'META-INF/native-image/**'
nor exclude 'META-INF/**/root/lib/arm64-v8a/include/cvkernels.h'
worked for me unfortunately. I still get the exact same error message: File 'root/lib/arm64-v8a/include/cvkernels.h' uses reserved file or directory name 'lib'.
Any other advice?
I'm running into a similar issue:
File 'root/lib/arm64-v8a/ffmpeg' uses reserved file or directory name 'lib'.
Has there been any updates to address this?
Same problem. Did you solved it @marwfair?
It looks like we need to move those files from /root/lib
into /lib
instead:
https://developer.android.com/guide/app-bundle/app-bundle-format
I'm not sure how to do that, they are already under /lib
in the JAR files. For some reason the tool that you are using to create bundles moves them under /root
instead, so if you figure out why it's doing that, fixing that should make it work.
Thank you for your quick comment Samuel!
I succeed💪. I was placing the ffmpeg-android-arm.jar, ffmpeg-android-arm64.jar, ffmpeg-android-x86.jar, and ffmpeg-android-x86_64.jar in the app/libs path instead of placing the image .so files in jniLibs/arm64-v8a and jniLibs/arm64-v7a.
Thank you again for your work! 😊
Hello @rgm-22 I'm having the same issue:
Execution failed for task ':app:packageReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.PackageBundleTask$BundleToolWorkAction
> File 'root/lib/commons-codec-1.8.jar' uses reserved file or directory name 'lib'.
Could you please provide me with more details to solve the problem?
Hi @yasserakbbach!
Be careful where you are placing this "commons-codec-1.8.jar".
You need to follow this file structure:
app/libs -> place the ".jar" libraries
app/src/main/jniLibs -> place the compiled libraries (".so" files) following the arm64-v8a, armeabi, armeabi-v7a, etc. structure.
I hope to help!
Hi @rgm-22 again, Thanks for your input, I've just solved the problem by deleting the following dependencies (they were unused anyways)
implementation 'commons-codec:commons-codec:1.10'
implementation 'com.google.guava:guava:28.0-android'
implementation 'org.apache.directory.studio:org.apache.commons.codec:1.8'
Hi @yasserakbbach!
I'm glad you succeed 💪😀.
Thank you @rgm-22
Hii @rgm-22 I am using FFMPEG and placed complied FFMPEG into resourse/lib/ folder and it's totally working fine in debug mode, But when I am creating release bundle it shows error "File 'root/lib/arm64-v8a/ffmpeg' uses reserved file or directory name 'lib'."
Please help me how can resolve this problem
Hi @lakharasachin-qf !
Sorry for the late response.
Please, try to follow this structure:
app/libs -> place the ".jar" libraries
app/src/main/jniLibs -> place the compiled libraries (".so" files) following the arm64-v8a, armeabi, armeabi-v7a, etc. structure.
I hope to help!
Hi @rgm-22!
I'm adding the libraries under app/libs
:
Adding on build.gradle the following:
The APK generation works but when I try to generate a bundle for uploading to the Google Play console I always obtain the same error:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade File 'root/lib/arm64-v8a/include/opencv2/imgcodecs/imgcodecs.hpp' uses reserved file or directory name 'lib'.
Any idea?
Hi @hamorillo!
In my case, I didn't add the "-android-arm.jar" "-android-arm64.jar" files in app/libs nither build.gradle.
Remeber to add the compiled libraries (".so" files) to app/src/main/jniLibs, following the arm64-v8a, armeabi, armeabi-v7a, etc. structure.
Please, let me know your results. I know that this process is frustrating when your app is ready to be uploaded to Google Play ☹
I hope to help!
After investigating this thoroughly, it appears that the cleanest solution to this issue is to get Gradle to extract the libraries for us, then tell the plugin for Android to pick them up from that location, and let it do whatever it wants with them. Something like the following in app/build.gradle
works fine for me:
configurations {
javacpp
}
task javacppExtract(type: Copy) {
dependsOn configurations.javacpp
from { configurations.javacpp.collect { zipTree(it) } }
include "lib/**"
into "$buildDir/javacpp/"
android.sourceSets.main.jniLibs.srcDirs += ["$buildDir/javacpp/lib/"]
tasks.getByName('preBuild').dependsOn javacppExtract
}
dependencies {
implementation group: 'org.bytedeco', name: 'javacv', version: '1.5.6'
javacpp group: 'org.bytedeco', name: 'openblas-platform', version: '0.3.17-1.5.6'
javacpp group: 'org.bytedeco', name: 'opencv-platform', version: '4.5.3-1.5.6'
javacpp group: 'org.bytedeco', name: 'ffmpeg-platform', version: '4.4-1.5.6'
...
}
To shorten that a bit further, it should be feasible to add this "javacppExtract" task to Gradle JavaCPP, but I'm not sure it's worth the trouble. If that snippet works well enough for everyone here, I may just add that to the docs somewhere. What do you all think?
I've added that code snippet in commit https://github.com/bytedeco/gradle-javacpp/commit/036a68560074db99d6e8910e185f2b63668f73f1 and also updated the JavaCV-android-example sample project in commit https://github.com/bytedeco/sample-projects/commit/2378afc54a0fe7a96bbc769e46d98fe9cef43f0d, so I think I'll consider this issue solved. If anyone still has any problems with that though, please let me know!
Hi All,
I have the same issue, but my issue does not relate to the lib.
I want to build aab to upload CH Play but it always fails and shows a message:
File 'root/res/drawable-hdpi/ic_launcher.png' uses reserved file or directory name 'res'.
I tried to search ic_launcher.png but my app does not use that name. I don't know how to resolve it. Please help me resolve this issue. I research for 2 days but was still stuck with it. Thanks.
Hi all, I have the same problem when build bundle on android studio
Error:
Execution failed for task ':app:packageDebugBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.PackageBundleTask$BundleToolWorkAction
> File 'root/lib/arm64-v8a/include/cvkernels.h' uses reserved file or directory name 'lib'.
Dependecy
implementation 'org.bytedeco:javacv:1.4.4'
implementation 'org.bytedeco.javacpp-presets:opencv:4.0.1-1.4.4:android-arm64'
implementation 'org.bytedeco.javacpp-presets:opencv:4.0.1-1.4.4:android-arm'
implementation 'org.bytedeco.javacpp-presets:opencv:4.0.1-1.4.4:android-x86
I still don't understand how to solve it, thanks.
Hi all, I have the same problem when build bundle on android studio
Error:
Execution failed for task ':app:packageDebugBundle'. > A failure occurred while executing com.android.build.gradle.internal.tasks.PackageBundleTask$BundleToolWorkAction > File 'root/lib/arm64-v8a/include/cvkernels.h' uses reserved file or directory name 'lib'.
Dependecy
implementation 'org.bytedeco:javacv:1.4.4' implementation 'org.bytedeco.javacpp-presets:opencv:4.0.1-1.4.4:android-arm64' implementation 'org.bytedeco.javacpp-presets:opencv:4.0.1-1.4.4:android-arm' implementation 'org.bytedeco.javacpp-presets:opencv:4.0.1-1.4.4:android-x86
I still don't understand how to solve it, thanks.
Im getting this same error still aswell and I'm unsure if this issue is resolvable still, I've been trying to just manually exclude all the libraries but it takes quite a while
Please try to follow the instructions here: https://github.com/bytedeco/gradle-javacpp?tab=readme-ov-file#the-platform-plugin
Hey,
Trying to build an Android bundle and not APKs. I get the following error:
File 'root/lib/arm64-v8a/include/opencv2/core/wimage.hpp' uses reserved file or directory name 'lib'.
I understand it's using a reserved bundle name probably, any idea how can it be fixed or when?
Thanks !