【发布时间】:2016-04-13 18:45:11
【问题描述】:
我在使用 Maven 导入 com.google.gson 时遇到问题。现在,我收到以下错误:
Error:(24, 17) Failed to resolve: junit:junit:4.12
和
Error:(22, 13) Failed to resolve: com.google.code.gson:gson:2.5
这是项目的 build.gradle:
buildscript {
repositories {
jcenter()
maven { url 'http://repo1.maven.org/maven2' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
repositories {
jcenter()
mavenCentral()
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这里是“模块:应用程序”的 build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.name.testversion"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.5'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
}
请告诉我如何解决这些问题并成功将“com.google.code.gson:gson:2.5”导入 Android Studio 以用于此项目。
另外,你知道,我是 Android Studio 的新手,只是为了把它放在透视图中,这是我第一次在 Android Studio 中使用 Maven,但不是第一次使用 Maven。
【问题讨论】:
标签: java android maven android-studio import