相关疑难解决方法(0)

Android Gradle找不到符号类Gson

所以我将gson-2.2.4.jar添加到libs目录(我正在使用android studio).我的项目找不到gson的东西,所以我在"项目结构"中将它作为库依赖项添加到我的模块中.当我尝试运行该项目时,构建失败并出现以下错误:

Error:(12, 23) Gradle: package com.google.gson does not exist
Error:(37, 3) Gradle: cannot find symbol class Gson
Error:(37, 19) Gradle: cannot find symbol class Gson
Run Code Online (Sandbox Code Playgroud)

为什么我不能让这个工作?我在别处读到gradle应该自动处理所有内容,如果它放在lib目录中.

android gradle android-gradle-plugin

51
推荐指数
5
解决办法
8万
查看次数

无法解决:com.google.code.gson:gson:2.3.1

错误:(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 …
Run Code Online (Sandbox Code Playgroud)

android gradle gson android-studio

3
推荐指数
2
解决办法
2万
查看次数