Android Gradle cannot find symbol class Gson

前端 未结 10 1354
温柔的废话
温柔的废话 2020-12-08 19:07

So i added gson-2.2.4.jar to the libs dir (I\'m using android studio). My project couldn\'t find the gson stuff so I added it as a library dependency to my module in the \"P

10条回答
  •  攒了一身酷
    2020-12-08 19:35

    I've faced with same issue.

    To solve it be sure that you specify maven central for android plugin

    repositories {
        mavenCentral()
    }
    

    And it should be added twice if you are defining build script

    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:0.5+'
        } 
    }
    
    
    repositories {
        mavenCentral() 
    }
    
    
    apply plugin: 'android' dependencies {    
        compile 'com.google.code.gson:gson:2.2.4'
        compile 'com.android.support:support-v4:13.0.0'   
        compile project(':libraries:volley') 
    }
    

提交回复
热议问题