AndroidStudio 问题集
问题1
12/25 13:54:04: Launching 'app' on Google Pixel 3a.
Installation did not succeed.
The application could not be installed: INSTALL_FAILED_OLDER_SDK
List of apks:
[0] 'D:\android\ODMtest\app\build\outputs\apk\debug\app-debug.apk'
The application's minSdkVersion is newer than the device API level.
此问题是:应用程序的最低可运行SDK版本比你运行设备API级别更新,将你的APP最低SDK版本调低一点即可,如下图在红框3处[Min SDK Version]选择低一点的SDK版本就可以
问题2:
Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
把build.gradle中把这个classpath换成新一点的版本。最好也把gradle和gradle wrapper的版本也都换成一个新一点的
3 Could not find com.android.tools.build:gradle:7.0.3. Searched in the following locations:
在github上下载了一个项目,导入androidstudio报如下错误:
Could not find com.android.tools.build:gradle:7.0.3.
Searched in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/gradle/7.0.3/gradle-7.0.3.pom
If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
Required by:
project :
Add google Maven repository and sync project
Open File
解决方案:
项目的project的build.gradle文件加入google()这一行即可
buildscript {
repositories {
google() //加入此行
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method dependencyResolutionManagement() for arguments [settings_1w6p35uf24mcbjrm93cdet6az$_run_closure1@30bc3c9] on settings 'aaa' of type org.gradle.initialization.DefaultSettings.
解决方案:将settings.gradle文件删除以下内容
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
}
}
只剩如下两行即可
rootProject.name = "aaa"
include ':app'
评论