gpt4 book ai didi

android - Qt Android输出APK在〜/android-build\build\outputs\apk\debug中生成

转载 作者:行者123 更新时间:2023-12-03 04:50:41 25 4
gpt4 key购买 nike

问题:我想在Qt项目中使用Android构建系统(版本3),但是此gradle版本(与旧版本2相比)会将生成的输出apk文件的位置更改为$buildDir/outputs/apk/debug之下,而不是$buildDir/outputs/apk(添加了debug)文件夹),但是当Qt Android套件尝试将应用安装到Android设备时,它只会在旧位置显示,而无法找到apk文件。我检查了Android Studio及其它是否表明Gradle 3正常工作
旧位置:$build_folder/android-build\build\outputs\apk\my.apk新位置:$build_folder/android-build\build\outputs\apk\debug\my.apk
错误(编译):

adb: error: cannot stat 'D:/Qt/FireBase/build-client01-Android_for_armeabi_v7a_GCC_4_9_Qt_5_11_0_for_Android_armv73-Release/android-build//build/outputs/apk/android-build-debug.apk': No such file or directory



仅当我对Qt生成的默认 build.gradle进行更改以将gradle设置为版本3时,才会发生此问题,默认生成的文件将 classpath设置为旧版本 2.3.3
旧: classpath 'com.android.tools.build:gradle:2.3.3'新增: classpath 'com.android.tools.build:gradle:3.1.0
我还有其他更改,也需要更改 gradle-wrapper.properties,这是更新的文件:

build.gradle


buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}

dependencies {
//classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:4.0.1' // google-services plugin
classpath 'com.android.tools.build:gradle:3.1.0'
}
}

allprojects {
repositories {
jcenter()
//google() // Google's Maven repository
maven {
url "https://maven.google.com"
}
}
}

apply plugin: 'com.android.application'


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

}

android {
/*******************************************************
* The following variables:
* - androidBuildToolsVersion,
* - androidCompileSdkVersion
* - qt5AndroidDir - holds the path to qt android files
* needed to build any Qt application
* on Android.
*
* are defined in gradle.properties file. This file is
* updated by QtCreator and androiddeployqt tools.
* Changing them manually might break the compilation!
*******************************************************/

compileSdkVersion androidCompileSdkVersion.toInteger()

buildToolsVersion androidBuildToolsVersion

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
res.srcDirs = [qt5AndroidDir + '/res', 'res']
resources.srcDirs = ['src']
renderscript.srcDirs = ['src']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
}

lintOptions {
abortOnError false
}
}

dependencies {
// ...


//libfirebase_auth.a
//libfirebase_app.a
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.android.gms:play-services-base:15.0.1'

// Getting a "Could not find" error? Make sure you have
// added the Google maven respository to your root build.gradle
}
apply plugin: 'com.google.gms.google-services'

gradle-wrapper.properties


#Mon Feb 20 10:43:22 EST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

最佳答案

我在build.gradle上使用它:

android {
...
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "../" + outputFileName
}
}
}

关于android - Qt Android输出APK在〜/android-build\build\outputs\apk\debug中生成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51541635/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com