简体   繁体   English

在使用gradle实验0.6.0-alpha1时,useLibrary有什么变化?

[英]What has useLibrary changed to in gradle experimental 0.6.0-alpha1?

I am trying to port my gradle.build over to gradle experimental. 我正在尝试将我的gradle.build移植到gradle实验中。 I have modified my existing android configuration over as below: 我修改了我现有的Android配置,如下所示:

android {
    compileSdkVersion = compileSdk
    buildToolsVersion = buildTools
    useLibrary "org.apache.http.legacy"
    defaultConfig.with {
        minSdkVersion.apiLevel = 13
        targetSdkVersion.apiLevel = compileSdk
        versionName = fullVersion
        multiDexEnabled = true
    } 
}

However, upon compiling, I seem to get the error: 但是,在编译时,我似乎得到了错误:

Error:(148, 1) A problem occurred configuring root project.> Exception thrown while executing model rule:model.android @ build.gradle line 145, column 1> Could not find method useLibrary() for arguments [org.apache.http.legacy] on root project 错误:(148,1)配置根项目时出现问题。>执行模型规则时抛出异常:model.android @ build.gradle第145行,第1列>无法为参数找到方法useLibrary()[org.apache.http .legacy]在根项目上

Probably since I am unsure what has useLibrary been modified to. 可能因为我不确定useLibrary被修改为什么。 If I comment this out, the build goes on for a significant till it fails to find the http methods it might be expecting from the above library. 如果我对此进行评论,那么构建会继续进行,直到它找不到上面库可能期望的http方法。 Can someone please provide some pointers on how do I got about including this library in gradle experimental? 有人可以提供一些指示,说明我如何在gradle实验中包含这个库?

This should work to use "org.apache.http.legacy" both regular gradle and gradle-experimental 这应该可以使用“org.apache.http.legacy”常规gradle和gradle-experimental

Remove the useLibrary line: 删除useLibrary行:

useLibrary "org.apache.http.legacy"

Add to gradle(module): 添加到gradle(模块):

dependencies {
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
}

Hope not too late. 希望不要太晚。 Put org.apache.http.legacy.jar file under libs folder... And include this in your dependencies 将org.apache.http.legacy.jar文件放在libs文件夹下...并在依赖项中包含它

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Gradle插件google-services不适用于gradle-experimental:0.6.0-alpha7 - Gradle plugin google-services does not work with gradle-experimental:0.6.0-alpha7 带有gradle-experimental:0.6.0-alpha6的Android Studio 2.0 Preview 5中的Android NDK - Android NDK in Android studio 2.0 preview 5 with gradle-experimental:0.6.0-alpha6 Android Unsatisfied Link 使用 gradle 实验 v0.6.0-beta6 - Android Unsatisfied Link using gradle experimental v0.6.0-beta6 带有Gradle-Experimental:0.6.0-beta5的OpenCV4Android链接错误 - OpenCV4Android link error with Gradle-Experimental:0.6.0-beta5 没有找到gradle dsl方法'uselibrary()' - gradle dsl method not found 'uselibrary()' useLibrary的原理与build.gradle中的compile files('')的原理有什么区别? - What's the difference between principles of useLibrary and compile files('') in build.gradle? gradle 属性“实验性且不受支持”是什么意思? - What does it mean for a gradle property to be "experimental and unsupported"? Android studio实验性插件0.6.0 NDK调试 - Android studio Experimental Plugin 0.6.0 NDK Debugging AndroidManifest.xml中的uses-library标签与Gradle中的useLibrary - uses-library tag in AndroidManifest.xml vs useLibrary in Gradle Gradle实验包括 - Gradle-experimental includes
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM