nrs*_*ser 12 gradle android-studio
注意:我无法发布链接,所以我想你需要去这里跟随参考.对不起,不是我的规矩.
尝试将项目导入Android Studio 0.2.9时出现以下错误:
Could not execute build using Gradle distribution
'http://services.gradle.org/distributions-snapshots/
gradle-1.8-20130830160653+0000-bin.zip'.
A problem occurred configuring project ':library'.
A problem occurred configuring project ':library'.
Failed to notify project evaluation listener.
Neither path nor baseDir may be null or empty
string. path='' basedir='<projects folder>/
drag-sort-listview/library'
Consult IDE log for more details (Help | Show Log)
Run Code Online (Sandbox Code Playgroud)
该项目最初是一个Maven项目(1).我在Eclipse ADT中打开它,/librabry/build.gradle
按照(2)中的说明生成一个文件.
生成的Eclipse ADT build.gradle
看起来像:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 7
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['']
resources.srcDirs = ['']
aidl.srcDirs = ['']
renderscript.srcDirs = ['']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
Run Code Online (Sandbox Code Playgroud)
我不得不改变第6行
classpath 'com.android.tools.build:gradle:0.4'
Run Code Online (Sandbox Code Playgroud)
至
classpath 'com.android.tools.build:gradle:0.5+'
Run Code Online (Sandbox Code Playgroud)
让Android Studio停止说版本不匹配.我还添加了一个/settings.gradle
包含的文件
include ':library'
Run Code Online (Sandbox Code Playgroud)
和/local.properties
包含内容的文件
# This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Applications/Android Studio.app/sdk
Run Code Online (Sandbox Code Playgroud)
然后,我试图/settings.gradle
通过在'文件|中选择它来导入文件 导入项目...'对话框.我选中了"使用自动导入"并在对话框中选择了"使用带有验证的gradle包装器"选项(3).完整的idea.log
条目可以在(4)查看.
任何帮助将不胜感激,谢谢.
Dic*_*cas 12
如果您正在使用,这将发生 Environment Variables
:
android {
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
Run Code Online (Sandbox Code Playgroud)
您还没有在位于项目根目录的gradle.properties文件中定义这些变量.
要解决此问题,请确保定义了变量,这是我的gradle.properties文件中的示例:
RELEASE_STORE_FILE=app_keystore.jks
RELEASE_STORE_PASSWORD=password
RELEASE_KEY_ALIAS=MyAppKey
RELEASE_KEY_PASSWORD=password
Run Code Online (Sandbox Code Playgroud)
(OP 在问题编辑中回答。转换为社区 wiki 答案。请参阅没有答案的问题,但问题在评论中解决(或在聊天中扩展))
OP 写道:
好的,解决了。问题在于
android.sourceSets
in下的空列表build.gradle
,我将它们注释掉以解决该错误。这是我目前的build.gradle
:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.4'
}
}
apply plugin: 'android-library'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 7
buildToolsVersion "17.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
// java.srcDirs = ['']
// resources.srcDirs = ['']
// aidl.srcDirs = ['']
// renderscript.srcDirs = ['']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
Run Code Online (Sandbox Code Playgroud)
希望对大家有帮助。
归档时间: |
|
查看次数: |
14732 次 |
最近记录: |