Android Studio 3.4 新建工程扫除障碍

安转Android Studio 3.4,新建的工程模板并不能正常编译通过,需要进行一些设定。

1. 新建的工程模板后,自动进行Sync(下载junit等的依赖库失败),会有如下错误:

ERROR: Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not download junit.jar (junit:junit:4.12)
Show Details
Affected Modules: app

对应方法有两个:

方法1。如果不需要junit,在build.gradle中注掉即可:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    //testImplementation 'junit:junit:4.12'
    //androidTestImplementation 'androidx.test:runner:1.2.0'
    //androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

再次Sync成功。build成功。

方法2。在build.gradle(project)中加入mavenCentral()就没问题了

buildscript {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}
allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}

2. 运新安卓模拟器,出现错误:

ERROR: This AVD's configuration is missing a kernel file! Please ensure the file "kernel-ranchu" is in the same location as your system image.

解决方法:

确认模拟器配置的是当前选择安卓版本,X86模拟器。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值