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.
Related
Running a Flutter project and after upgrading Android Studio to version 4.0 I get the following warning when opening the Android module in Android Studio:
Warning: root project 'android': Unable to resolve additional project configuration.
Details: org.apache.tools.ant.BuildException: Basedir C:\src\flutter\.pub-cache\hosted\pub.dartlang.org\path_provider_linux-0.0.1+1\android does not exist.
I can see that now this android directory does indeed not exist.
On the project screen, it says: Gradle project sync failed. Basic functionality (e.g. editing, debugging) will not work properly.
I have tried to reinstall both Android Studio and Flutter, but it doesn't help.
How can this problem be solved?
in path_provider_linux & path_provider_macos no android project
https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_linux
https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_macos
In the pubspec.yaml file under dependencies use:
path_provider: ^1.6.5
Dont use latest one
In build.gradle make sure classpath is as follow:
classpath 'com.android.tools.build:gradle:3.6.3'
In gradle-wrapper.properties file makes sure this is the distribtion URL:
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
Make sure in all the gradle files the latest version are there.Android studio only will help that and try again
Could not find com.android.tools.build:gradle:4.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle /4.1/gradle-4.1.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/
4.1/gradle-4.1.jar
https://maven.google.com/com/android/tools/build/gradle/4.1/gradle-4.1.pom
https://maven.google.com/com/android/tools/build/gradle/4.1/gradle-4.1.jar
Required by:
project :
Open File
I downloaded the source code of an app and when I try to run I get all kinds of gradle errors. I have been trying to solve it since two days but so far I have been unable to do so. I updated Android Studio to 3.1 but the error is still there. Nothing works.
Here is what I have tried so far:
I deleted all the gradle version in the 'dist' folder and let
Android Studio download everything again.
I have tried to enable
'offline mode' in the Gradle build settings in Android Studio.
I also enabled 'use local gradle distribution'.
P.S: Creating a new project works fine. I just need to run this specific project.
The Gragle version declared is 4.1, but since you are using Android Studio 3.1, the gradle version should be declared as follow into your application build.gradle:
buildscript {
...
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
...
}
}
You can find the link between the gradle plugin version and the actual gradle version here
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.
I've upgraded the gradle build tools from 1.2.3 to 1.3.1 and started seeing the following error on gradle sync. I had no issues with 1.2.3 version. I'm on gradleVersion 2.3. Is there anyway I can avoid this error?
Error:Your project contains 2 or more modules with the same
identification com.salesforce.android:AndroidCommon at
":AndroidCommon" and ":AndroidCommon:AndroidCommon". You must use
different identification (either name or group) for each modules.
AndroidCommon is one of the libraries that I'm using. I tried with versions 1.3 and 1.4 of Android Studio. Seems like the AS version doesn't matter.
This kind of error happens in these cases:
2 modules have the same identification (group+name). Check the code
1 module has the same name of the root project
In the first case:
rename one of the modules
update the settings.gradle file with the new name
run gradlew clean assemble
In the second case.
rename the root project or follow the steps above.`
This check was introduced with gradle-plugin 1.3.x.
You can check the code:
gradle plugin 1.3.1
gradle plugin 1.2.3
You have 2 modules with the same name as the error states change name of a module.
To rename a module
go to settings.gradle and rename the module to your new name. Then close Android Studio, and rename the folder using File Explorer. Now reopen Android studio and your module name will be updated.
I just started using Android Studios and wanted to look at some of the sample code that Google already provides in their apk samples.
However, when I try importing a project, it tells me:
"You are using an old, unsupported version of Gradle. Please use version 1.8 or greater.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)
Consult IDE log for more details (Help | Show Log)"
In my .gradle/wrapper/dists, I have gradle-1.6-bin and gradle-1.8-bin.
I tried updating the gradle to 1.8 from 1.6 in the gradle-wrapper.properties file in the project itself, but I can't seem to save the file after editing it.
Step 1: Change line in build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:0.6.+'
}
Step 2:
In the YourProject.iml file, delete the entire component name="FacetManager" tag.
Step 3
(Maybe not necessary): In the Android SDK manager, install (if not already installed) Android Support Repository under Extras.
Refer to these 2 links. It answers your question.
getting error when importing project in android studio?
Unable to import Eclipse project to Android Studio