I'm trying to add the gson library to my android project (I'm devloping using the Andrdoid-studio).

我正在尝试将gson库添加到我的android项目中(我正在使用Andrdoid-studio开发)。

To add the library, I did changed the AppProject/AppName/build.gradle file in this way:

要添加库,我确实以这种方式更改了AppProject / AppName / build.gradle文件:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.4'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

dependencies {
    compile files('libs/android-support-v4.jar')
    compile 'com.google.code.gson:gson:2.2.4'
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 4
        targetSdkVersion 16
    }
}

All seems to work until I try to use it.

一切似乎都有效,直到我尝试使用它。

When I try to include it with:

当我尝试将其包含在:

import com.google.code.gson;

Gradle complains affirming:

Gradle抱怨肯定:

Gradle: error: package com.google does not exist

4 个解决方案

#1


7

Possible duplicate : Specifying Maven dependencies in build.gradle doesn't work

可能重复:在build.gradle中指定Maven依赖项不起作用

(Using the command line, in the root of your project, run : ./gradlew clean && ./gradlew build)

(使用命令行,在项目的根目录中运行:./ gradlew clean && ./gradlew build)

更多相关文章

  1. Android项目实战--手机卫士01--启动界面
  2. android-eclipse-phonegap 2..9以下(包含2.9)的项目配置
  3. android项目 之 记事本(14) ----- 手势缩放与拖拽图片
  4. 使用scala编写Android项目
  5. Android自定义控件——开源组件SlidingMenu的项目集成
  6. Proguard可以对Android库项目(APKLIB)进行模糊处理吗?
  7. 最近一年做Android项目过程中,对其的一些注意事项(优化)以及问题
  8. Android小项目之六 apk下载
  9. Say Hello To Android(解析Android项目目录结构)

随机推荐

  1. java 导出excel 格式与文件扩展名指定的
  2. 2016年团体程序设计天梯赛-初赛 - 重要的
  3. 打造Linux下vim之(一)vim中的JavaScript插
  4. java对象判断是否为空工具类
  5. ARM-LINUX 系列 (七) ----java的安装
  6. eclipse下,tomact jar包存在 但是无法解析
  7. 一个关于javascript压缩混淆工具的问题
  8. 百度Java架构师分享分布式锁的技术选型及
  9. Java常用类及其常用方法
  10. Spring与HSQLDB最新的2.4.0版本无法正常