gradle refuse to sync even after downloading from their site - android

I tried to sync my gradle in android studio and it showed me this error even after I tried to sync it locally, still the same error:
Error:BUG!
exception in phase 'class generation' in source unit
'ijinit0_8gov8jl8pmdtxuu0gk1mcw4af' unsupported Target MODULE

What Gradle and Java versions are you using?
Try downgrading them & delete the build and .gradle folders in your project directory

Related

gradle error in unity exported android project

I am going to use the build config property "multiDexEnabled true" to break 64K methods limit following link
https://developer.android.com/studio/build/multidex.html#about
I update to use unity 5.6.1f1 and android studio 2.3.3. I set "build system" option to "Gradle(New)", which is new added from 5.5, then click "Export" to create an android project.
I open the exported project with android studio, then I get the following error
I try the two blue links, but I keep geting this same result.
For my unity project, I only create an empty project and add a button to a unity scene, then export it. I have also tried to build API directly, it works.
It is important for me to export unity project to andoid studio project, because it can help us to use additional compile options
Do any one know what I miss? Or how to export unity project correctly?
Thanks
The gradle error text, if cannot see the image link
Error:org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection
Possible causes for this unexpected error include:Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I had the same issue with unity 2017.1.0b4 and Android Studio 2.3.3, gradle 3.3.
You should change android plugin for graddle version in Android studio to 2.3.3
You can specify the Android plugin for Gradle version in either the
File > Project Structure > Project menu in Android Studio, or the
top-level build.gradle file. The plugin version applies to all modules
built in that Android Studio project. The following example sets the
Android plugin for Gradle to version 2.3.3 from the build.gradle file:
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
https://developer.android.com/studio/releases/gradle-plugin.html
Check your local gradle version in directory -
C:\Users\yourname\.gradle\wrapper\dists
Modify your project gradle configuration -
project\gradle\wrapper\gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Make sure gradle-3.3-all match to your gradle version.
If you have wasted a lot of time fixing unity Gradle error but nothing worked then you tried unity internal builder but that gave "Parsing Package error"
then try this, it will not help you make your project using unity's Gradle but it will make your project without any error successfully.
Export your project from unity to a folder eg: ProjectName_Gradle.
open android studio, make sure you are connected to the internet .
close current project then select "Open Gradle, eclipse ADT, etc;" option and open ProjectName_Gradle folder.
check the version of buildTools installed in your android-SDK by opening android-SDK settings from the android studio itself.
edit "build.gradle" file under Gradle Scripts section or under your project.
and change "buildToolsVersion" to the latest version installed in your SDK.
then click "syn project with Gradle Files" from file option and let it sync.
it may ask to update Gradle version, then click update
now there should not be any errors.
now try building APK.

Error:Cause: invalid stream header: 000900D9 in android studio 2.3.1

I am using android studio 2.3.1 and it was working fine yesterday But now it throw me an error Error:Cause: invalid stream header: 000900D9
this message throw from Messages Gradle Sync dialog.
Below are the steps which i did to fixed this problem but nothing works for me
1.invalidate cache and restart
Delete scripts and scripts-remapped files from C:\Users\suraj.gradle\caches\3.3
and also checked many post in stackoverflow but nothing work for me and most of the questions put here are not answered by anyone yet .
Under my project structure
Compile Sdk version :Api 25
Build tool version :25.0.2
I was facing the same problem and was not able to figure out what exactly causes this problem.
But removing the whole .gradle folder (/home/$USER/.gradle in my case) and rebuilding the app fixed it.
I noticed that many users (me included) faced this issue using the 3.3 gradle version; update to 3.5 and it will be fine
Go to your console, run
./gradlew --stacktrace
If it says
GradleException: Could not read cache value from '[...]/.gradle/daemon/3.3/registry.bin'
go to this folder and delete the file registry.bin.lock. No need to delete the whole .gradle directory and download everything again.
Andrea's answer worked for me, too (i.e. upgrading gradle from 3.3 to 3.5). For the shake of completeness, I'd just like to add that you can update gradle in your Android Studio by going to:
File > Project Structure > Project
You might have to update your Android Plugin Version, too. Check the version compatibility table for more information.
File > Invalidate Caches / Restart
Error: Gradle sync failed: Cause: invalid stream header: 005C0044, 000900D9, ... or other some of the Gradle sync failed
There is a good method for this issue. you should update the android gradle as following in three steps:
1) Download latest gradle version form link: https://gradle.org/releases/
2) Unzip the download file and copy it in address: C:\Program Files\Android\Android Studio\gradle
3) In the android studio, change gradle version to the latest gradle version (4.5.1 based on the unzip file, which had been named as the gradle-4.5.1) in path: File>Project structure>Project>gradle version
4) In the android studio, change the gradle home file (File>Settings>Build,Execution,Development>gradle>gradle home) to address: C:\Program Files\Android\Android Studio\gradle\gradle-4.5.1.
It's gradle version.
I've updated gradle from 4.6 to 4.10.1 on one branch. Switched to another branch without gradle update and couldn't sync it. Updating gradle to the latest version on all branches helped solved the problem.
So check which gradle version you have in gradle/wrapper/gradle-wrapper.properties file and try to update it to match your .gradle directory (or just update to the latest one)
E.g.
there is a .gradle/4.10.1 directory
gradle/wrapper/gradle-wrapper.properties is pointing to the same gradle version
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
This Works
Delete
caches in .gradle
caches in folder where your android studio project is located
delete all iml files
delete .gradle in folder where your project is located
happy coding

Import a project to Android studio faced problems

I want reading an open source project so I select k9mail for start. The recommendation was run and reading this code in Android Studio. I import k9mail project to AS 1.2.1.1 version. I download gradle 2.4 version and added this in environment variable. When I want to run this application, but I receive some errors that I describe below:
1) When I click Run (Alt+Shift+F10), select Android Application, select my module (there is k9mail) and select USB Device, then I see a warning:
No JDK specified for module 'k-9-master'.
2) When I click on Run (Shift+F10), I faced this error in messages tab:
Gradle DSL method not found: 'android()'
Possible causes:
A)The project 'k-9-master' may be using a version of Gradle that does not contain the method.Open Gradle wrapper file
B)The build file may be missing a Gradle plugin. Apply Gradle plugin
When I updated gradle to 2.4, I changed classpath 'com.android.tools.build:gradle:1.2.3' to 'classpath 'com.android.tools.build:gradle:2.4'' from build.gradle of k9mail, but my problems were not solved.
I googled but I can't find solutions for my problems.
No jdk specified for the module.
For that you have to specify the jdk path through Project Structure.
You may also verify by looking at local.properties
For gradle related issues you just kindly update your gradle build and SDKs to latest versions.
This will minimize your gradle issues.

IDEA reports Error with Android Gradle Build Target

I cannot build the project using Idea, I get following message right after launch:-
Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation 'C:\Users\username\.gradle\wrapper\dists\gradle-1.11-bin\4h5v8877arc3jhuqbm3osbr7o7\gradle-1.11'.
content of following directory:
c:\Users\malousek\.gradle\wrapper\dists\gradle-1.11-bin\4h5v8877arc3jhuqbm3osbr7o7\gradle-1.11\
is following:
bin
init.d
lib
media
changelog, license, notice,
IDEA Settings for Gradle:
Use Default Gradle Wrapper (recommended)
Last time I tried Intellij 13 It had many problems with Gradle (1.11+), use Intellij EAP 14 or switch to Android Studio.
You can try removing "C:\Users\username.gradle\wrapper\dists\" directory and resync your gradle project.

Uploading file local path: XXX remote path: XXX I/O Error: EOF

On Android Studio 0.4.4, getting this error, even found this error in previous version too!
Uploading file local path:XXX/XXX.apk
remote path:/data/tmp/XXXX
I/O Error: EOF
"Sync Project with Gradle Files" should solve the problem.
Tools -> Android -> Sync Project with Gradle Files
The reason these errors tend to come up is because the Gradle file becomes out of sync. The way that I have seen in the past to solve this is to clean the project, confirm that the gradle properties is set to the correct version (which would be 0.6.+ atm), and then click the Gradle Sync button in the toolbar.

Categories

Resources