Error when importing a Gradle project into Android Studio - android

I am trying to import a Gradle project into Android Studio and get the following error:
This project does indeed compile when I run Gradle from the command line. I can also Open the project in Android Studio (vs Import) but then it tries to build using the Eclipse build script.
The gradle build was created by hand and not via the Eclipse export function.
My problem can be resolved in one of two ways:
1) Tell me how to force Android Studio to use Gradle instead of using the Eclipse build.
2) Help me find the reason for the Gradle import error.
I am using
Android Studio 0.2.2
Gradle 1.6 via gradlew

I finally found out why this didn't work.
There are two ways to include a project from within the settings.gradle file:
include ':..:source:compA-api'
and
include "source:compA-api"
project(':source:compA-api').projectDir = new File(settingsDir, 'source/compA/api')
I had used the second form and apparently Android Studio didn't like that :)

Related

Crystax usage with IntelliJ IDEA

I have tried the Crystax sample on IDEA, and I have compiled it successfully, got it to run on my phone.
However, when I try to modify the project, IDEA throws an error about Gradle version:
Error:The project is using an incompatible version of the Android Gradle "experimental" plugin.
Please update your project to use version 0.9.0.
Then I updated it and met new problems:
Gradle version 3.3 is required. Current version is 4.1.
Please fix the project's Gradle settings.
I choose to Fix Gradle wrapper and re-import project
Then the next error appears:
Cannot set readonly property: proguardFiles for class: com.android.build.gradle.managed.BuildType
Please, is there anyone who knows how to use Crystax on IDEA IDE?
I found an alternative way, which does not relies on AS to build.
Just set your system PATH to Crystax-ndk folder, set up your Application.mk and Android.mk, and run command:
ndk-build
then you will get the result lib or executable file, then, link it to your Android project.

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.

Could not find com.appdynamics:appdynamics-gradle-plugin:2.0

UPDATED Q : I have tried to run this sample eCommerce app on android studio 1.2.1, build 141.1903![enter image description here][1]..
https://github.com/Appdynamics/ECommerce-Android
and i did what is instructed to run it
but it keeps asking to upgrade gradle to gradle 2.0 or advance.(after i downloaded the new version 2.4).
how to upgrade or integrate gradle in android studio?
what other problems related to it I have to solve?
error I'm getting
Error:
Could not find com.appdynamics:appdynamics-gradle-plugin:2.0.
Searched in the following locations:
file //ANDRO1/gradle/m2repository/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.pom
file://ANDRO1/gradle/m2repository/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.jar
https // repo1.maven.org/maven2/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.pom
https // repo1.maven.org/maven2/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.jar
file /c/ Users/Piyush/.m2/repository/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.pom
file /C /Users/Piyush/.m2/repository/com/appdynamics/appdynamics-gradle-plugin/2.0/appdynamics-gradle-plugin-2.0.jar
Required by:
ECommerce-Android-master:app:unspecified
Just follow this istructions:
Clone a local copy of this project with
git clone https://github.com/Appdynamics/ECommerce-Android
Open Android Studio and Import Project (select app/build.gradle)
Android Studio will ask you to build the project with gradle.
Gradle will use the build.gradle inside the project.
The version of gradle is inside the gradle/wrapper/gradle-wrapper.properties file:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zi
Check for example the file inside the app:
You need put a directory called "adeum-maven-repo" in your project setup .
https://docs.appdynamics.com/display/PRO39/Instrument+an+Android+Application#InstrumentanAndroidApplication-SetupforGradle

Unity project as dependency in Gradle

I am trying to import an unity3d project to my android project as a module. All is okay, gradle sync finish without error, but when i add unity project as dependency to my project and run gradle sync then it says:
Error:Dependency myapplication:unityproject:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: /Users/michal/Documents/Projects/myapplication/unityproject/build/outputs/apk/unityproject-release-unsigned.apk
I tried google it, but with no luck... Thanks a lot for any tips...
I am using Android Studio (if it helps)
I can build and run standalone unity3d project on mobile device, problem is only when i am trying to add it as module (dependency) to another project
In your library's gradle.build, Change the line apply plugin: com.android.application to apply plugin: com.android.library and remove the setApplicationId
In Android Studio, you can't depend on an Android Application module (which has an APK as its output). You can only depend on Java libraries (which compile to JAR) or Android Library modules (which compile to AAR).
I'm an android noob, but I was able to import a simple Unity app into Android Studio by checking "Google Android Project" in the export dialog.
Deets:
* Unity 4.6.1
* Android Studio 1.0
(note if you download A.S. "1.0", you still need to do a software update a couple times to really get it)

Android Studio throws "'Runtime' is not a supported scope" when importing project

I have a problem importing a gradle project and maybe some of you can help me with this:
When I import an android project I get the following error message and the import gets cancelled:
Gradle 'myProject' project refreshed failed: //'Runtime' is not a supported scope. Supported scopes are [Compile, Test].: Gradle settings (a minute ago)
The project can be build on another machine but importing it on another doesn't work.
EDIT and SOLUTION: A non Android project which was part of 'myProject' had a dependency with runtime instead of compile. I don't know if the non Android project will run with compile but at least you should be able to import the project as a whole. If needed you can revert the changes and just receive a warning when starting Android Studio.

Categories

Resources