Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated apk does not contain jniLibs #147

Open
Neerajsh8851 opened this issue May 16, 2024 · 4 comments
Open

Generated apk does not contain jniLibs #147

Neerajsh8851 opened this issue May 16, 2024 · 4 comments

Comments

@Neerajsh8851
Copy link

image

Cargo.toml : https://github.com/Neerajsh8851/androidrust/blob/main/rust/Cargo.toml
app/build.gradle.kts : https://github.com/Neerajsh8851/androidrust/blob/main/app/build.gradle.kts

@paulirotta
Copy link

You might need

tasks.configureEach { task ->
if ((task.name == 'mergeDebugJniLibFolders' || task.name == 'mergeReleaseJniLibFolders')) {
task.dependsOn 'cargoBuild'
}
}

@peacefulprogram
Copy link

When I ran the code provided in the link above, the following error occurred
Execution failed for task ':app:mergeDebugJniLibFolders'.
image

@paulirotta
Copy link

@peacefulprogram I faced similar issues after updating the Android gradle plugin to 8.4.1

After days of fun, the solution seemed to be placing the cargo gradle plugin before others. Don't ask why- it is Android

in the "app" module gradle

plugins {
    id 'org.mozilla.rust-android-gradle.rust-android'
    id 'io.sentry.android.gradle' version '4.6.0' // This must be AFTER the rust-android plugin, otherwise "duplicate" errors
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'androidx.navigation.safeargs.kotlin'

and in the "project" gradle

plugins {
    id 'com.android.application' version '8.4.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.9.10' apply false
    id 'androidx.navigation.safeargs.kotlin' version '2.7.7' apply false
    id 'org.mozilla.rust-android-gradle.rust-android' version '0.9.4' apply false
}

@peacefulprogram
Copy link

peacefulprogram commented May 28, 2024

@peacefulprogram I faced similar issues after updating the Android gradle plugin to 8.4.1

After days of fun, the solution seemed to be placing the cargo gradle plugin before others. Don't ask why- it is Android

in the "app" module gradle

plugins {
    id 'org.mozilla.rust-android-gradle.rust-android'
    id 'io.sentry.android.gradle' version '4.6.0' // This must be AFTER the rust-android plugin, otherwise "duplicate" errors
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'androidx.navigation.safeargs.kotlin'

and in the "project" gradle

plugins {
    id 'com.android.application' version '8.4.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.9.10' apply false
    id 'androidx.navigation.safeargs.kotlin' version '2.7.7' apply false
    id 'org.mozilla.rust-android-gradle.rust-android' version '0.9.4' apply false
}

@paulirotta Thank you so much, it worked perfectly. You really saved me a lot of time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants