我正在尝试将Android异步Http客户端的依赖项添加到我的项目中.所以项目中有两个build.gradle文件.

根据我的理解,有不同类型的依赖:
这个问题是关于buildScript的依赖关系的存储库,解释一下前两种类型.
另外build.gradle(Project:My-app)说
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Run Code Online (Sandbox Code Playgroud)
所以我想Android Asynchronous Http Client的依赖代码应该在build.gradle(Module:app)中添加.
如果有人能够清楚地了解所有这些以便更好地理解,那就太棒了.
当我尝试在Android Studio中构建Android库项目时,我收到以下Gradle错误:
Gradle sync failed: Plugin with id 'com.android.library' not found.
Run Code Online (Sandbox Code Playgroud)
我对Gradle很新,这对我来说很困惑.为什么会这样?
build.gradle文件如下:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Android Studio 2.1.2.我用minSdkVersion开始了一个新项目为19.我的活动扩展了AppCompatActivity.该项目以使用片段的空活动开始.
使用API 24预览content_main.xml时,一切都很好.在预览API 19时,我遇到以下渲染问题:
The following classes could not be instantiated:
- android.support.v7.widget.Toolbar
java.lang.IllegalStateException: This app has been built with an incorrect configuration. Please configure your build for VectorDrawableCompat
Run Code Online (Sandbox Code Playgroud)
我添加了我发现的与gradle相关的所有内容(2个文件):
classpath 'com.android.tools.build:gradle:2.1.2'
**vectorDrawables.useSupportLibrary = true**
buildToolsVersion "24.0.1"
compile 'com.android.support:appcompat-v7:24.1.1'
**compile "com.android.support:support-v4:24.1.1"**
compile 'com.android.support:design:24.1.1
Run Code Online (Sandbox Code Playgroud)
但仍然出现错误.我在互联网上找到了很多答案.但没有人帮助.使用API 19的新工具栏是否有问题?
如果我通常使用这些库,我想要一种方法将它们包含在我创建的任何项目中。
implementation 'com.android.support:recyclerview-v7:25.1.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton:butterknife:8.5.1'
implementation 'com.squareup.okhttp3:okhttp:3.6.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.4.2'
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
我在 Kotlin 中构建了一个模块,然后导入到我的项目中。我minifyEnabled在模块的build.gradle文件中输入了false 。但是看不到源代码或者无法放置断点。
它适用于 Java,但不适用于 Kotlin。
我无法在 android 模拟器中运行我的应用程序。它以前可以工作,但有些东西打破了它。
错误信息:
A problem occurred evaluating root project 'android'.
> Could not find method implementation() for arguments [com.google.android.material:material:1.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Run Code Online (Sandbox Code Playgroud)
我正在运行 gradle 3.2.1。这是我的 build.gradle 文件的构建脚本:
buildscript {
ext.kotlin_version = '1.2.71'
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:3.2.1'
implementation "com.google.android.material:material:1.1.0"
}
}
Run Code Online (Sandbox Code Playgroud)