How do I add Guava to my Android Studio project?

后端 未结 6 623
故里飘歌
故里飘歌 2020-12-14 18:28

First and foremost, I am aware of the existence of this question - How do I add a library project to Android Studio? - and unfortunately, it has not helped me.

My go

6条回答
  •  一整个雨季
    2020-12-14 18:38

    Thats a lot of info in your question. I am using Guava too. But I don't remember going through any of this trouble..

    Guava is available on the mavencentral. So adding guava to your project should be fairly simple. AFAIK, you do not need to checkout, build and add a project dependency etc..

    See gradle file for my app below.

    buildscript {
        repositories {
            mavenCentral()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:0.5.+'
        }
    }
    
    apply plugin: 'android'
    
    repositories {
         mavenCentral()
    }
    
    // Dependencies
    dependencies {
        compile fileTree(dir: 'libs', include: '*.jar') // jar files under the libs folder.
        compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar' // actionbarsherlock,
        compile 'com.android.support:support-v4:18.0.0' // android support lib
        compile 'com.google.code.gson:gson:2.2.4' // google GSON
        compile 'com.google.guava:guava:14.0.1' // guava 14.0.1
    }
    

提交回复
热议问题