【发布时间】:2019-10-06 18:01:44
【问题描述】:
我写了一个示例代码并收到了这些错误。
错误:找不到符号类 Android J Unit 4。
和
错误:package android x test ext j unit runners 不存在
我安装了最新版本的 android studio,在运行每个代码后,我收到了这些错误。
这些错误是什么意思?
代码:
package com.example.hello;
public class JavaBasics {
public static void main(String args[]){
System.out.println("Hello World");
}
}
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.hello"
minSdkVersion 14
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
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'
}
【问题讨论】:
-
您好,请问您可以添加您的应用模块 build.gradle 文件吗?
-
嗨。我为模块 build.gradle 文件添加了更多截图
-
新图片上传