Error:(24, 17) Failed to resolve: junit:junit:4.12 "openFile:/home/jeevansai/AndroidStudioProjects/MyApplication/app/build.gradle"
Вышеупомянутая ошибка появляется в Studio Android, имеет много проблем, делающих проект. Может кто-то говорить решение его.
вывод cat /home/jeevansai/AndroidStudioProjects/MyApplication/app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.example.jeevansai.myapplication"
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
final def types = buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
types
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}
вывод apt-cache policy junit4
junit4:
Installed: 4.12-2ubuntu1
Candidate: 4.12-2ubuntu1
Version table:
*** 4.12-2ubuntu1 0
500 http://in.archive.ubuntu.com/ubuntu/ wily/main amd64 Packages
100 /var/lib/dpkg/status
Gradle - построить инструмент, объединенный в Студии Android: это загружает Ваши зависимости от проекта (файлы банки, которые Вы используете в своем кодексе) из хранилищ знатока (знаток, другой известный строит инструмент с возможностями зависимостей от пакета и отдаленной экосистемой хранилищ). Одно из наиболее используемого хранилища jcenter () .
Ваше gradle отсутствие файла конфигурации хранилища: добавьте эту часть кодекса к Вашему gradle файлу (/home/jeevansai/AndroidStudioProjects/MyApplication/app/build.gradle
): между apply plugin
и android {...}
раздел.
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
compileSdkVersion 21
...
, Кроме того , если Вы не кодируете модульные тесты в данный момент, Вы можете простой комментарий junit зависимость от app/build.gradle
файл:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
}
Во всяком случае , Вы можете всегда загружать необходимый артефакт от центрального знатока и вставлять Ваш /libs
справочник:
wget 'http://central.maven.org/maven2/junit/junit/4.12/junit-4.12.jar' -O /home/jeevansai/AndroidStudioProjects/MyApplication/app/libs/junit-4.12.jar