Невозможно добавить 64-битную библиотеку в мое приложение, Play Store отклоняет ее - PullRequest
2 голосов
/ 15 октября 2019

У меня есть приложение, которое использует FFmpeg для обработки видео. С тех пор существует новое требование 64-битных собственных библиотек. Я пытался скомпилировать мое приложение с 64-разрядными двоичными файлами без успеха.

  • Я попытался экспортировать статически скомпилированные двоичные файлы, а затем добавил библиотечный модуль, который их компилирует (поскольку увидел, что могут быть некоторые проблемы со статическими при сборке apk или пакета).
  • Я добавил код abiFilters, предложенный Android, затем попытался исключить x86 и x86_64, поскольку при чтении где-то они могут вызывать проблемы, а количество устройств, использующих эти архитектуры, составляет менее 4%. сделал это, исключив из фильтров abi (в модулях App и Library). Добавлены сплиты, включая abis для armeabi 32 и 64 и исключая x86, и установку уникальных кодов версий для каждого abi в приложении и библиотеке (почему-то фильтры не работают * См. Рис.).

Нетиз этого получилось, когда я изучил, что мой apk добавляет 64-битные ресурсы, но в lib появляется только 32-битная версия (что, по-моему, и является причиной жалобы PlayStore). * См. Прикрепленное изображение enter image description here

Я не совсем понимаю, что мне не хватает. Вот мои файлы Gradle: Библиотека FFmpegANdroid gradle:

apply plugin: 'com.android.library'
//apply plugin: 'com.github.dcendents.android-maven'
apply plugin: "com.jfrog.bintray"

// This is the library version used when deploying the artifact
version = '0.3.2'

android {
    compileSdkVersion build_versions.compile_sdk_ver
    buildToolsVersion build_versions.build_tools_ver
    defaultConfig {
        minSdkVersion build_versions.min_sdk_ver
        targetSdkVersion build_versions.target_sdk_ver
        versionName "FFMPEG"
        ndk {
            abiFilters  "armeabi-v7a", "arm64-v8a"
        }
    }

    sourceSets.main {
        assets.srcDirs = ['assets']
        jni.srcDirs = [] //disable automatic ndk-build
        jniLibs.srcDirs = ['libs']
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
splits {
    splits {
        abi {
            include "armeabi-v7a", "arm64-v8a"
            exclude "x86","x86_64"
        }
    }
}
libraryVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
        def versionCodes = ["armeabi-v7a":1, "arm64-v8a":2]
        def abi = output.getFilter(com.android.build.OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }
    }
}
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    androidTestImplementation 'com.squareup.assertj:assertj-android:1.0.0'
    implementation third_party_deps.writingminds.ffmpegandroid
}



/*install {
repositories.mavenInstaller {
    // This generates POM.xml with proper parameters
    pom {
        project {
            packaging POM_PACKAGING

            // Add your description here
            name 'FFmpeg Android'
            description = POM_DESCRIPTION
            url POM_URL

            // Set your license
            licenses {
                license {
                    name POM_LICENCE_NAME
                    url POM_LICENCE_URL
                }
            }
            developers {
                developer {
                    id POM_DEVELOPER_ID
                    name POM_DEVELOPER_NAME
                    email 'hitesh@writingminds.com'
                }
            }
            scm {
                connection POM_SCM_URL
                developerConnection POM_SCM_URL
                url POM_URL

            }
        }
    }
}
}*/

task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    source = android.sourceSets.main.java.srcDirs
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}
artifacts {
    archives javadocJar
    archives sourcesJar
 }

Properties properties = new Properties()


properties.load(project.rootProject.file('local.properties').newDataInputStream())

// https://github.com/bintray/gradle-bintray-plugin
bintray {
    user = properties.getProperty("bintray.user")
    key = properties.getProperty("bintray.apikey")

    configurations = ['archives']
    pkg {
        repo = "maven"
        // it is the name that appears in bintray when logged
        name = "ffmpeg-android"
        websiteUrl = "https://github.com/writingminds/ffmpeg-android-java"
        vcsUrl = "https://github.com/writingminds/ffmpeg-android-java.git"
        licenses = ["GPL-3.0"]
        publish = true
        version {
            gpg {
                sign = true
                passphrase = properties.getProperty("bintray.gpg.password")
            }
            mavenCentralSync {
                sync = true
                user = properties.getProperty("bintray.oss.user") //OSS user token
                password = properties.getProperty("bintray.oss.password") //OSS user password
                close = '1'
            }
        }
    }
}

Gradle приложения:

import org.apache.tools.ant.taskdefs.condition.Os
import com.android.build.OutputFile

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion build_versions.compile_sdk_ver
    buildToolsVersion build_versions.build_tools_ver
    defaultConfig {
        minSdkVersion build_versions.min_sdk_ver
        targetSdkVersion build_versions.target_sdk_ver
        applicationId "com.mydomain.myapp"
        versionCode app.version_code
        versionName app.version_name
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        ndk {
            abiFilters  "armeabi-v7a", "arm64-v8a"
        }
    }
    def keystoreProperties = Os.isFamily(Os.FAMILY_WINDOWS) ?
            "KeyStoreWin.properties" : "KeyStore.properties"
    Properties props = new Properties()
    props.load(new FileInputStream(file(project.property(keystoreProperties))))

    signingConfigs {
        storeSignature {
            storeFile file(props['KEYSTORE'])
            storePassword props['KEYSTORE_PASSWD']
            keyAlias props['KEYSTORE_ALIAS']
            keyPassword props['KEYSTORE_ALIAS_PASSWD']
        }
    }
    buildTypes {
        debug {
            debuggable true
            versionNameSuffix app.deb_version_name
            signingConfig signingConfigs.storeSignature
        }
        release {
            signingConfig signingConfigs.storeSignature
            debuggable false
            versionNameSuffix app.rel_version_name
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            renderscriptDebuggable false
        }
    }
    splits {
        abi {
            include "armeabi-v7a", "arm64-v8a"
            exclude "x86","x86_64"
        }
    }
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "arm64-v8a":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
    bundle {
        language {
            enableSplit = true
        }
        density {
            enableSplit = true
        }
        abi {
            enableSplit = true
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':FFmpegAndroid')
    implementation official_deps.androidx.appcompat
    implementation official_deps.kotlin.kotlin_stdlib_jdk7

    implementation official_deps.androidx.navigation_fragment_ktx
    implementation official_deps.androidx.navigation_ui_ktx

    //Constraint Layout
    implementation official_deps.androidx.constraintlayout
    //Lyfecycle
    implementation official_deps.androidx.lifecycle_extensions
    implementation official_deps.androidx.cardview
    implementation official_deps.androidx.recyclerview
    //Support for Material Components
    implementation official_deps.material.material

    implementation third_party_deps.retrofit2.retrofit
    implementation third_party_deps.okhttp3.okhttp
    implementation third_party_deps.okhttp3.okhttp_urlconnection
    implementation third_party_deps.okhttp3.logging_interceptor
    implementation third_party_deps.retrofit2.converter_gson

    implementation official_deps.anko.anko_sdk25_coroutines
    implementation official_deps.anko.anko_appcompat_v7_coroutines

    //Room
    implementation official_deps.androidx.room_ktx
    kapt official_deps.androidx.kapt_room_compiler

    //Support for Dagger 2
    implementation official_deps.dagger.dagger
    kapt official_deps.dagger.kapt_dagger_compiler

    //Gson
    implementation official_deps.gson.gson

    implementation third_party_deps.otaliastudios.cameraview

    implementation third_party_deps.mp4parser.isoparser

    implementation official_deps.androidx.core


}

repositories {
    mavenCentral()
}

Может кто-нибудь помочь мне определить проблему? чего мне не хватает?

** Я использую:

  • Android Studio 3.5.1 стабильная
  • gradle-5.4.1

1 Ответ

1 голос
/ 17 октября 2019

Вы выполнили все эти шаги в документации Android ?.

Как вы создавали свое приложение ?

Для разделения вопроса попробуйте это:

 splits {
      abi {
            reset()
            include "armeabi-v7a", "arm64-v8a"
          }
   }
...