Android Studio Play资产交付CMake错误

问题描述

我的应用程序很大,因此无法上传。我正在尝试进行Play Asset Delivery,但是构建失败并显示错误消息,并且我不确定这意味着什么。我用了Google,但它与Android Studio没有关系,我不完全了解它的含义

E:\ Apps \ TestApp \ app \ src \ main \ CMakeLists.txt:C / C ++ debug | x86:CMake错误:CMake无法确定目标:main的链接器语言

我正在遵循Google的这两个指南

https://developer.android.com/guide/app-bundle/asset-delivery/build-native-java https://developer.android.com/guide/playcore#import-library

这是我的build.gradle

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


apply plugin: 'com.android.application'

def playcoreDir = file('E:/Apps/TestApp/play-core-native-sdk')

android {
    compileSdkVersion 29
    buildToolsversion "29.0.2"

    assetPacks = [":assetpack"]

    defaultConfig {
        applicationId "com.example.memorizethequranv5"
        minSdkVersion 16
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

        externalNativeBuild {
            cmake {
                // Define the PLAYCORE_LOCATION directive.
                arguments "-DANDROID_STL=c++_static","-dplAYCORE_LOCATION=$playcoreDir"
            }
        }
        ndk {
            // Skip deprecated ABIs. Only required when using NDK 16 or earlier.
            abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
        }
    }

    buildTypes {
        release {
            // Include Play Core Library proguard config files to strip unused code while retaining the Java symbols needed for JNI.
            proguardFile "$playcoreDir/proguard/common.pgcfg"
            proguardFile "$playcoreDir/proguard/per-feature-proguard-files"

            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
        }
        debug {
        }
    }
    externalNativeBuild {
        cmake {
            path 'src/main/CMakeLists.txt'
        }
    }
    ndkVersion '21.3.6528147'
}

dependencies {
    // Use the Play Core AAR included with the SDK.
    implementation files("$playcoreDir/playcore.aar")

    implementation filetree(dir: 'libs',include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.github.SuperRabbitD:NumberPicker:d6c3a75e61'
}

这是我的CMakeLists.txt,看起来非常像Google的指南,但出现上述错误。该文件位于TestApp> app> src> main

cmake_minimum_required(VERSION 3.6)

# Add a static library called “playcore” built with the c++_static STL.
include(E:/Apps/TestApp/play-core-native-sdk/playcore.cmake)
add_playcore_static_library()

#// In this example “main” is your native code library,i.e. libmain.so.
add_library(main SHARED)

target_include_directories(main PRIVATE E:/Apps/TestApp/play-core-native-sdk/include)

target_link_libraries(main android playcore)

谢谢!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...