RaR*_*aRa 3 android gradle gson android-studio
错误:(25,13)无法解决:com.google.code.gson:gson:2.3.1
在Project Structure对话框中显示
的build.gradle:应用
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "com.app.main"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
}
}}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.google.android.gms:play-services-base:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile project(':Uni_Image_Lod_Lib') }
Run Code Online (Sandbox Code Playgroud)
builde.gradle:项目
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}}
allprojects {
repositories {
jcenter()
}
}
Run Code Online (Sandbox Code Playgroud)
步骤如下:
Android Studio版本1.3.2
重启电脑
无效缓存/重新启动
黎明依赖.
但没有什么可改变的.现在将是什么解决方案.
经过一些变化
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.app.main"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
}
}}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile project(':Uni_Image_Lod_Lib') }
Run Code Online (Sandbox Code Playgroud)
并获得错误重建
在脱机模式下构建项目时检测到未解决的依赖项.请禁用离线模式,然后重试.
错误:配置项目':app'时出现问题.
无法解析配置':app:_debugCompile'的所有依赖项.无法解析com.google.code.gson:gson:2.3.1.要求:APP:app:unspecified com.google.code.gson的缓存版本:gson:2.3.1可用于离线模式.没有缓存版本的com.google.code.gson:gson:2.3.1可用于离线模式.
然后我在prefrences-> Build,Execution,deployment - > gradle中看到了.
项目级别设置是:
勾选使用本地gradle分布
全球gradle设置:
离线工作未勾选
Pan*_*ora 15
compile 'com.google.code.gson:gson:2.3.1'
Run Code Online (Sandbox Code Playgroud)
删除.1并使其编译
'com.google.code.gson:gson:2.3'
Run Code Online (Sandbox Code Playgroud)
as 2.3.1不稳定而且活着,这就是它给你的错误.+根据我的知识,也不会在编译时使用,因为它不是最佳实践.
小智 12
你可以简单地做以下事情:
buildscript {
repositories {
mavenCentral() //Add following
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
mavenCentral() // Add following
jcenter()
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18630 次 |
| 最近记录: |