当前位置:   article > 正文

Android Studio调试中的坑

Android Studio调试中的坑

1、新建Android工程后编译发现报错

2、发现无33和34的SDK更新

3、查看google相关文档

Android Gradle 插件 8.3 版本说明  |  Android Studio  |  Android Developers

如果需要支持相关更高SDK需要的Android Studio版本和Android Gradle 插件是有版本要求的,相关要求如下

而我的Android studio版本较低因此不支持更新更高的SDK操作

4、对比本地有一个能编译过的代码

将build.grade的相关配置从

dependencies {
    implementation 'androidx.appcompat:appcompat:1.6.1'
    implementation 'com.google.android.material:material:1.11.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.5'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

修改到如下配置后

dependencies {
    implementation 'androidx.appcompat:appcompat:1.5.0'
    implementation 'com.google.android.material:material:1.6.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

5、grade离线导入

下载后的grade总安装失败,将相关下的gradle-7.2-bin.zip放入C:\Users\mao.zhang\.gradle\wrapper\dists\gradle-7.2-bin\2dnblmf4td7x66yl1d74lt32g即可,无需解压,其中2dnblmf4td7x66yl1d74lt32g为Android studio自动生成目录。

再次编译,APK正常生成

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/381082
推荐阅读
相关标签
  

闽ICP备14008679号