Gyo*_*der 181 android gradle android-studio
我在使用Android Studio(0.1.5)编译我的应用时遇到问题.该应用程序使用2个库,我包括如下:
settings.gradle
include ':myapp',':library',':android-ColorPickerPreference'
Run Code Online (Sandbox Code Playgroud)
的build.gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android'
dependencies {
compile files('libs/android-support-v4.jar')
compile project(':library')
compile project(':android-ColorPickerPreference')
}
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 7
targetSdkVersion 16
}
}
Run Code Online (Sandbox Code Playgroud)
编译时我收到此消息:
Gradle: A problem occurred configuring project ':myapp'.
> Failed to notify project evaluation listener.
> Configuration with name 'default' not found.
Run Code Online (Sandbox Code Playgroud)
你能帮我这个消息吗?谢谢!
guy*_*ock 82
在我的情况下,编译后gradle tasks --info,日志在那里:
使用空构建文件评估项目':libraries:VolleyLibrary'.
所以它找不到库的build.gradle文件.原因是文件夹结构.
它是
-libraries
--volley
---VolleyLibrary
Run Code Online (Sandbox Code Playgroud)
它应该是
-libraries
--VolleyLibrary
Run Code Online (Sandbox Code Playgroud)
pas*_*ssy 60
我忘了拉所有子模块.所以我的
compile project(':something')
Run Code Online (Sandbox Code Playgroud)
无法解决.
git submodule update --init
Run Code Online (Sandbox Code Playgroud)
小智 20
compile fileTree(dir: '//you libraries location//', include: ['android-ColorPickerPreference'])
Run Code Online (Sandbox Code Playgroud)
在应用程序的gradle文件中使用上面的行而不是
compile project(':android-ColorPickerPreference')
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你
Ahm*_*sir 19
以下程序解决了我的问题:
添加以下脚本
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
}
apply plugin: 'android-library'
repositories {
mavenCentral()
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.0"
defaultConfig {
minSdkVersion 10
targetSdkVersion 18
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
Run Code Online (Sandbox Code Playgroud)添加include ':yourModuleName'你的settings.gradle
Via*_*lav 12
I've also faced with this error - I forgot to create build.gradle script for library project.
Mag*_*s W 10
还有另一个原因 - 我试图在settings.gradle中包含一个模块
include ':MyModule'
project(':MyModule').projectDir = new File(settingsDir, '../../MyModule')
Run Code Online (Sandbox Code Playgroud)
唯一的问题是,我刚从Eclipse导入模块忘了将目录移到我的应用程序项目之外,即路径'../../MyModule'不存在.
小智 7
我的解决方案是简单地从settings.gradle文件中删除一行,该文件代表一个不存在的模块:
include ':somesdk'
Run Code Online (Sandbox Code Playgroud)
并从主项目的build.gradle中删除相应的行:
compile project(':somesdk')
Run Code Online (Sandbox Code Playgroud)
出现此错误时,我遇到了一个git子模块问题.尝试运行gradle tasks --info更详细的问题描述.我第一次使用gradle tasks --debug,这几乎没有那么有用--info.
假设您要将库(例如MyLib)添加到项目中,您应该按照以下步骤操作:
include ':MyPrj', 'Libraries:MyLib'.注意:此include语句的当前目录是主项目文件夹.如果将项目粘贴到文件夹中,则必须提及相对于主项目目录的地址.在我的情况下,我将MyLib粘贴到Libraries文件夹中.此库名称不是关键字,您可以为其选择其他名称+然后选择模块依赖项并有你的库你可以根据需要选择它们希望它有所帮助
小智 5
就我而言,我使用的是在Windows下运行但在Linux上运行失败的Gradle文件.该include ':SomeProject'和compile project(':SomeProject')是大小写敏感的,并没有发现.
乍一看一切看起来都很好,但有些人在这里发现了一个可能有用的答案: https: //stackoverflow.com/a/16905808/7944
即使最初的答案作者听起来也不是非常自信,但值得跟进。另外,你没有说任何关于你的目录结构的事情,所以我假设它是无聊的默认内容,但不能确定。
| 归档时间: |
|
| 查看次数: |
239193 次 |
| 最近记录: |