Reputation: 1307
NOTE: i can't post links, so i guess you'll need to go here to follow the references. sorry, not my rule.
i'm getting the following error when attempting to import a project into 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)
the project was originally a Maven project (1). i opened it in Eclipse ADT, generated a /librabry/build.gradle
file per the instructions at (2).
the Eclipse ADT generated build.gradle
looked like:
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')
}
}
i had to change line 6 from
classpath 'com.android.tools.build:gradle:0.4'
to
classpath 'com.android.tools.build:gradle:0.5+'
to get Android Studio to stop saying the versions were miss-matched. i also added a /settings.gradle
file containing
include ':library'
and a /local.properties
file with the contents
# 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
i then attempted to import the /settings.gradle
file by selecting it in the 'File | Import Project...' dialog. i have 'Use Auto-import' checked and 'Use gradle wrapper with verification' option selected in the dialog (3). the full idea.log
entry can be viewed at (4).
any help would be greatly appreciated, thanks.
Upvotes: 12
Views: 15653
Reputation: 1
Modify file(String.valueOf(RELEASE_STORE_FILE)) in
android {
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
Upvotes: 0
Reputation: 81
you may miss a file in project, for "gradle.properties" file, because this file is include some varies, for example , our custom var, such key.storefile key.keypassword, you should check this file is exists or not.
Upvotes: 0
Reputation: 12639
This will happen if you are using Environment Variables
like so:
android {
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
And you have not defined those variables in your gradle.properties file located at the root of your project.
To fix this, make sure your variables are defined, here is an example from my gradle.properties file:
RELEASE_STORE_FILE=app_keystore.jks
RELEASE_STORE_PASSWORD=password
RELEASE_KEY_ALIAS=MyAppKey
RELEASE_KEY_PASSWORD=password
Upvotes: 12
Reputation: 6822
The error may be referring to your keystore's path. If the keystore's path doesn't work, it will think it's null. If you just want to use your keystore's file name (instead of the full path), make sure the keystore is in the root directory of your project.
android {
signingConfigs {
release {
storeFile file(**DoubleCheckPath**)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
Upvotes: 3
Reputation: 5893
(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )
The OP wrote:
ok, solved it. the issue is with the empty lists under
android.sourceSets
inbuild.gradle
, I commented them out to resolve the error. Here's my currentbuild.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')
}
}
hope that helps y'all.
Upvotes: 2