While importing project as gradle have error Cause: unexpected end of block data
. Project has several modules. I\'m using Idea 132.719 and 1.8 gradle.
I had the same problem. Turned out the build.gradle specified a buildToolsVersion that was not installed:
android {
buildToolsVersion "18.1"
...
}
while I only had 18.1.1 installed. Changing the buildToolsVersion in build.gradle fixed the problem for me. If this doesn't fix it for you, carefully inspecting the Intellij log might reveal the problem.
You can use the Android SDK Manager to see which version of the build tools is installed.
Very late answer, and I'm sure you don't care anymore, but someone else might.
Hope this helps .
yeah,
STEP 1: open the module build.gradle and find buildToolsVersion.
STEP 2: modified the value to the warning value.
I also had the same problem. I resolved this issue by setting ANDROID_HOME environmental variable. export ANDROID_HOME=/android_sdk_root_dir
Hope this helps.
A good tip in with these type of problems if to use the command line version of gradlew, it can give you much more useful information, for the above problem it might look like this:
Error code from Android studio
Gradle 'bluetooth-new-circle' project refresh failed
Error:Cause: unexpected end of block data
Error code from command line gradlew with the same project:
~/source_code/bluetooth$ ./gradlew clean assembleDebug :AccessoryController:clean UP-TO-DATE :BluetoothAudioProxy:clean UP-TO-DATE :BluetoothGatt:clean UP-TO-DATE :ScaleMonitor:clean UP-TO-DATE :UsbMonitor:clean UP-TO-DATE :AccessoryController:preBuild FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':AccessoryController:preBuild'.
The SDK Build Tools revision (19.0.2) is too low for project ':AccessoryController'. Minimum required is 19.1.0
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 10.078 secs ~/source_code/bluetooth$
Just open app/src/main/build.gradle
and Android Studio will probably make a yellow highlight over the text version of buildToolsVersion
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.1.0" //<--- THIS PART WILL BE HIGHLIGHTED
defaultConfig {
...
This means that Gradle has tried to compile with the wrong version of Gradle build tool installed. Usually the version will be lower.
Open then Tools->Android->SDK Manager
and find the highest version of Android SDK Build-Tools
and wrote that version. In my case, it's 19.1.
Recompile and it will work.