Gradle返回包不存在
16lz
2021-01-22
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)
更多相关文章
- Android项目实战--手机卫士01--启动界面
- android-eclipse-phonegap 2..9以下(包含2.9)的项目配置
- android项目 之 记事本(14) ----- 手势缩放与拖拽图片
- 使用scala编写Android项目
- Android自定义控件——开源组件SlidingMenu的项目集成
- Proguard可以对Android库项目(APKLIB)进行模糊处理吗?
- 最近一年做Android项目过程中,对其的一些注意事项(优化)以及问题
- Android小项目之六 apk下载
- Say Hello To Android(解析Android项目目录结构)