gpt4 book ai didi

java - 使用 Android Studio 调试旧 Android 版本

转载 作者:行者123 更新时间:2023-12-01 10:07:19 25 4
gpt4 key购买 nike

我使用 Android 版本 23 进行开发。但现在我喜欢调试仅安装版本 19 的设备。

为此,我将 gradle 文件更改为

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "19.1.0"

defaultConfig {
applicationId "com.mydomain.myapp"
minSdkVersion 16
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile fileTree(include: ['dtp_library'], dir: 'libs')
compile project(':libs:dtp_library')

compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:design:19.+'
compile 'com.android.support:support-v4:19.+'
}

但是这一行

compile 'com.android.support:design:19.+'

抛出编译器错误

Failed to resolve 'com.android.support:design:19.+'

如何让它发挥作用?

最佳答案

这是我的 build.gradle 的示例,它在 API 19 设备上运行得非常好。

需要注意的一点是,您不需要递减编译 SDK。这就像安装了 Java 8,但编译了 Java 6 代码。它仍然有效。

此外,我认为 appcompat-v7 库依赖于 support-v4 库,因此您不需要包含它。

apply plugin: 'com.android.application'

repositories {
jcenter()
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.androidstack.app"
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
}

ext {
supportLibVersion = '23.2.1' // variable that can be referenced to keep support libs consistent
}

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

compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
}

关于java - 使用 Android Studio 调试旧 Android 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36363197/

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