When importing a maven Android project into eclipse I get the following error:
Could not update project assistance configuration
me.gladwell.eclipse.m2e.android.configuration.ProjectConfigurationException:
org.eclipse.core.runtime.CoreException: Could not resolve artifact android:android:pom:2.1_r2
In the Package Explorer I have an error in the pom.xml files in "MyProject" and "MyProject-it" that says:
Missing artifact android:android:pom:2.1_r2
I have cloned the Maven Android SDK Deployer to my drive and run the "mvn install" command from the root of this folder, and it ran with success for the API I need.
I have confirmed in the Android SDK manager that all relevant APIs are installed and that paths for JAVA_HOME, ANDROID_HOME and M2_HOME are correct, but I still get this error.
I'm running Ubuntu 14.04 in VMware btw.
Can anyone help / point me in any direction?
Here's the solution I found:
I found out that I had to change the <version> tag in the parent pom.xml file from 2.1_r2 to 2.1_r3. That solved my problem.
Related
I tried importing via import project wizard, didn't work. This project is using Gradle Kotlin DSL. I am using Android Studio 3.1.4.
I tried running gradle idea and got this message
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/user/Projects/firebaseauthui/FirebaseUI-Android/build.gradle.kts' line: 400
* What went wrong:
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
What is the recommended way to import this project as they have migrated to Kotlin DSL?
This has been reported on GitHub Repository. Still I have issue importing.
A note on importing the project using Android Studio: Using 'Project
from Version Control' will not automatically link the project with
Gradle (issue #1349). When doing so and opening any build.gradle.kts
file, an error shows up: Project 'FirebaseUI-Android' isn't linked
with Gradle. To resolve this issue, please git checkout the project
manually and import with Import from external model.
According to your issue
* What went wrong:
SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Looks like Android SDK is not configured in your project which is why it is failing to compile project in Gradle.
Try this solution:
Go to your project ('/Users/user/Projects/firebaseauthui/FirebaseUI-Android/')
Find local.properties file.
Open that file and add this variable if it's not there
sdk.dir=`path of your Android SDK`(it is where you've put android sdk in local storage)
"For more generic way, check this solution" SO answer by #Ziggy192
I did update the Android Studio, current version
Android Studio 3.1.4 Build #AI-173.4907809, built on July 24, 2018
JRE: 1.8.0_152-release-1024-b01 x86_64 JVM: OpenJDK 64-Bit Server VM
by JetBrains s.r.o Mac OS X 10.13.6
I did update Kotlin plugin, current version
Version: 1.2.70-release-Studio3.1-1
Still I could not import from Version Control- GitHub.
Manual git checkout then open build.gradle.kts with Android Studio did solve the issue.
Getting started:
1. Get an Android Studio version 3.0 and above (You got it)
2. Make sure you have install Kotlin plugin.
Go to File | Settings | Plugins | Install JetBrains plugin… and then search for and install Kotlin. If you are looking at the "Welcome to Android Studio" screen, choose Configure | Plugins | Install JetBrains plugin… You'll need to restart the IDE after this completes.
3. Make sure you have Firebase Authentication
Go to Tools | Firebase | Authentication | Connect to Firebase | Add Firebase Authentication to your app.
With this step, you don't have to manually download the Firebase AUth.
4. Done
Source : Kotlin for Android Firebase Auth
I cloned the FirebaseUI-Android project and tried to reproduce your issue. I found two solutions for it.
If you just want to build the project locally as you mentioned in one of your comment. You can use command line to do it.
First you need to create an environment variable named ANDROID_HOME in your operating system and set it to SDK location. It's required so that gradle can find all the tools required to build the project.
Open a command prompt(Windows OS) on the project root directory.
Type gradlew assembleDebug to build the project. You can also try to run other task available in gradle as per your requirement.
I tried to import project via wizard but it did not work for me as well. I then first opened a random android project in Android studio and then tried
File > Open... > Selected the FirebaseUI-Android Project > New Window
These two procedure worked for me but I'm not sure if it's the recommended way.
Note: Please make sure you set the ANDROID_HOME if you get SDK location missing issue in any of the two solutions. You will also get error in project as google-services.json is missing and I hope you know how to fix it.
My Android Studio is v3.1.4 and Kotlin Plugin is v1.2.50
The error is suggesting that the android studio cannot find your android SDK you should go to:
File -> Project Structure -> in right panel choose SDK location -> set your Android SDK location.
Try to sync project with Gradle files from Android Studio:
Step 1 - File -> Sync Project with Gradle file
Step 2 - Once sync is done :- File - Invalidate caches/Restart.
I hope this will help you.
I am consistently running into the same error when I run "react-native run-android." Here is the error:
* What went wrong:
A problem occurred configuring project ':app'.
> failed to find Build Tools revision 23.0.1
I tried this --> failed to find Build Tools revision 21.1.1 - sdk up to date --> and got the same error.
I installed the android sdk with homebrew and my ANDROID_HOME export is in my .bash_profile and .zshrc file as:
export ANDROID_HOME=/usr/local/opt/android-sdk
When I go to this directory and look in the "build-tools" directory I do see 23.0.1.
Does anyone have any advice?
EDITS:
I'm also unable to run "react-native run-android" with any flags. I'm not seeing any output from stacktrace, info or debug.
Finally figured it out! Chris Geirman's answer is also valuable, so I would start there as I did. One thing to mention is that I installed React Native with Homebrew. If Chris's method does not work look into the following:
Go to your React Native project directory that is created by react-native init
Open the android directory.
Open the file local.propertiesIf you don't have this file you can make one.
Make sure the sdk.dir value is pointing to the correct directory. In my case the path need to be sdk.dir = /usr/local/opt/android-sdk
As an extra bit of reassurance I also located that directory above to make sure that the build tools version that was missing (23.0.1) was in that directory.
EDIT:
I found that this is a post install error. If you run react-native init and you don't have $ANDROID_HOME set, you will run into this error.
I found this in the book Learning React Native and thought you might find this quote helpful.
If you receive a warning about a missing package, run android and check to see if
that package is listed as “installed”. If not, install it. If it is installed, but React Native
can’t find it, follow the steps above to try and fix any issues with your development
environment. You should also check to make sure that your ANDROID_HOME environ‐
ment variable is properly set and points to your installation of the Android SDK. For
example, on my system:
$ echo $ANDROID_HOME
/usr/local/opt/android-sdk
When I try to build a project on Android Studio, I get this error:
Compilation completed with 1 error and 0 warnings in 9 sec
1 error
0 warnings
org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
What can I do to fix it?
UPDATE:
When I look at the Error Log, I saw this:
org.jetbrains.plugins.gradle.settings.GradleSettings cannot be cast to org.jetbrains.plugins.gradle.settings.GradleSettings:
org.jetbrains.plugins.gradle.settings.GradleSettings cannot be cast to org.jetbrains.plugins.gradle.settings.GradleSettings
Please read the log from:
On Microsoft Windows:
[Windwos Drive]\Documents and Settings\[your username]\.AndroidStudioPreview\system\log
On Mac and Linux: ~/.AndroidStudioPreview/system/log/
And you will find the tmp download path of gradle-1.6-bin.zip. For example, mine is:
2013-05-17 09:42:16,934 [ 283002] INFO - ution.rmi.RemoteProcessSupport - Unzipping C:\Documents and Settings\Kiki.J.Hu\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\gradle-1.6-bin.zip to C:\Documents and Settings\Kiki.J.Hu\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok
...
Caused by: com.intellij.openapi.externalSystem.model.ExternalSystemException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.
java.util.zip.ZipException: error in opening zip file
So I know the cause: I downloaded an incomplete ZIP package.
Then I downloaded the full ZIP package from http://services.gradle.org/distributions/gradle-1.6-bin.zip manually and copied this ZIP package to:
Windows: C:\Documents and
Settings\Kiki.J.Hu\.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\
Mac OS X: ~/.gradle/wrapper/dists/gradle-1.10-all/6vpvhqu0efs1fqmqr2decq1v12/
Everything is OK now.
For OS X:
Install Homebrew as a package manager. Then on Terminal, run:
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Install Gradle:
brew install gradle
It is the easiest way to get Gradle.
Before you click to new project, go to configure and set your proxy. I recommend set host name and port number, since I had problems with auto-detect proxy settings. Check your connection in settings.
I also had issues downloading Gradle through Android Studio.
This was my workaround:
Download Gradle directly from http://services.gradle.org/distributions/gradle-1.6-bin.zip
Copy the contents of gradle-1.6 to \Android\android-studio\plugins\gradle
Copy gradle.jar to \Android\android-studio\lib\
Restart Android Studio
Hope this helps!
Edit the gradle wrapper settings in gradle/wrapper/gradle-wrapper.properties and change gradle-1.6-bin.zip to gradle-1.8-bin.zip.
./gradle/wrapper/gradle-wrapper.properties :
#Wed Apr 10 15:27:10 PDT 2013
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
It should compile without any error now.
In my case this was because the system had low memory. When I closed some applications, the error disappeared.
For me it turned out to be my firewall, which is VIPRE, was blocking the Gradle.org site and quietly causing a bad gradle-1.7-bin.zip to be created under .gradle\wrapper\dists\.
I had to open VIPRE and add gradle.org to "Bad Web Site Exceptions" (menu File -> Settings -> Firewall).
Then I downloaded http://services.gradle.org/distributions/gradle-1.7-bin.zip using a browser and overwrote the bad version. I restarted Android Studio, and all is good.
FYI, on my Mac, it was downloading Gradle into the ~/.gradle directory. You can see how it's progressing by looking there:
du ~/.gradle
I noticed that my MyProject/gradle/wrapper/gradle-wrapper.properties file was completely empty, so I deleted it and Android Studio proceeded to download whatever it needed.
After that it worked.
I tried Kiki Hu's solution, and it worked. After that, there will be more downloads from the Maven repository which includes Dalvik Debug Monitor Server (DDMS), Guava, etc., which again is not required if you are exporting from Eclipse into Android Studio.
If you're like me, you tried to start a version prior to 0.2.0. Following Google's notes
in Getting Started with Android Studio, you'll need to remove and re-install Android Studio.
"Note: There is not a patch update available from 0.1.9 to 0.2. To update from Android Studio 0.1.x to 0.2.x, you must install a new Android Studio bundle from this page. The reason for that is that we have made changes to the bundled SDK such that it includes a pre-configured local Maven repository which can serve up the v4 support library and which is required for creating new projects."
Also be aware that if you have your Android SDK files stored in C:\Program Files (x86)\Android\android-studio\sdk you should move them before the uninstall, or you'll need to download the SDK files again.
After the un-install and re-install, it is now working on my Windows 7 64-bit system.
Remove all files from C:\Documents and Settings\[User]\.gradle\wrapper\dists\, rebuild the project and rebuild your project on Android Studio. It works for me :)
I have noticed one thing: When my Android Studio is build 130.737825, it automatic downloads Gradle 1.6 to C:\Users\yourname\.gradle/wrapper/dists/gradle-1.6-bin/72srdo3a5eb3bic159kar72vok/.
However, when I update my Android Studio to build 132.821530, it automatically downloads Gradle 1.7 to C:\Users\Administrator\.gradle\wrapper\dists\gradle-1.7-bin\2g3i7gan25uopmtc0lnjb1l9ff.
I don't know if it matters.
I had this error under fresh installation of IntelliJ (14.0), the problem was that I had not specified JDK. Fix: press ctrl + A + S (project structure), and check if SDK is correct.
my error looked like this:
Error:Android Gradle Build Target: org.gradle.tooling.GradleConnectionException: Could not execute build using Gradle installation ...
I have tried using Jenkins with my Android project which I'm using Maven for. I have tried following this tutorial except the emulator part since I don't have any tests (yet). http://vitorbaptista.com/continuous-integration-for-android-apps-with-jenkins-and-maven3/
I am getting the following error when I try building my project in Jenkins:
message : Failed to execute goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
(default-generate-sources) on project ....: Execution
default-generate-sources of goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
failed: Could not find tool 'aapt'. Please provide a proper Android
SDK directory path as configuration parameter
... in the plugin . As an
alternative, you may add the parameter to commandline:
-Dandroid.sdk.path=... or set environment variable ANDROID_HOME. cause : Execution default-generate-sources of goal
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.3.0:generate-sources
failed: Could not find tool 'aapt'. Please provide a proper Android
SDK directory path as configuration parameter
... in the plugin . As an
alternative, you may add the parameter to commandline:
-Dandroid.sdk.path=... or set environment variable ANDROID_HOME.
Here is my configuration for Android and Maven:
Jenkins
(that folder is the right one, I've checked a million times)
Project
I have tried even chmod 777'ing the path to my SDK directory in the case Jenkins doesn't have access.
Any ideas?
Unfortunately, it was as simple as installing the platform tools. Since I have always worked with the SDK via UI, I haven't thought about the installation of the platform tools. After installing the platform tools, everything built.
The command was as simple as:
[sdkdir]/tools/android update sdk --no-ui --filter platform-tool
I am trying to get setup to use Maven and pom.xml files in Eclipse for my Android projects. I have Eclipse Indigo setup (m2e included), Android SDK installed, ADT installed. I am struggling to understand what it means to "Install the m2e-android-plugin" (I am always taken to this page which provides instructions on installing it, but which I cannot follow) Specifically, when I go through the instruction on that page, after I complete all the steps in part 2, my structure does not have "Maven Dependencies" and my pom.xml file shows the following error:
Project build error: Unresolveable build extension: Plugin
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.1.1 or one of its dependencies could
not be resolved: The following artifacts could not be resolved:
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1,
com.android.ddmlib:ddmlib:jar:r16, org.sonatype.sisu:sisu-inject-bean:jar:2.1.1,
org.sonatype.sisu:sisu-guice:jar:no_aop:2.9.4, org.codehaus.plexus:plexus- archiver:jar:2.0.1, junit:junit:jar:3.8.1,
org.codehaus.plexus:plexus-io:jar:2.0.1, org.codehaus.plexus:plexus-utils:jar:3.0, commons-jxpath:commons-
jxpath:jar:1.3, commons-io:commons-io:jar:2.0.1, org.ow2.asm:asm:jar:4.0, commons-lang:commons-lang:jar:
2.6, org.sonatype.aether:aether-util:jar:1.12: Failure to transfer
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1 from http://repo1.maven.org/
maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central
has elapsed or updates are forced. Original error: Could not transfer artifact
com.jayway.maven.plugins.android.generation2:android-maven-plugin:jar:3.1.1 from/to central (http://
repo1.maven.org/maven2): No response received after 60000
along with:
Project build error: Unknown packaging: apk
on the line
<packaging>apk</packaging>
I have tried set up a fresh second IDE myself and everything works as expected, suppose you have installed both Android SDK and Maven properly (better to use latest version), these are the only Eclipse plugins required to work with Mavenized Android Project:
adt
m2e
m2e-android
Check out my screenshot Help -> Install New Software... -> what is already installed:
If you follow instructions from this page starting with a new project, the <packaging> error is most likely due to earlie version of maven-release-plugin (if you do not explicitly specify one). By hovering mouse on <packaging> element in pom.xml, you should get some hint like:
maven-resources-plugin prior to 2.4 is not supported by m2e. Use maven-resources-plugin version 2.4 or later.
Adding the following plugin under <plugins>:
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
</plugin>
Then Right-click on new project and select Maven -> Update Project Configuration, this should fix all error and give you a working example.
I had the same problem trying to install the android m2e in eclipse JUNO.
Then tried to install through "Install new software" wizard, instead of market place.
Add the following as an update site and select "Android For Maven eclipse" from the listed softwares and install.
http://rgladwell.github.com/m2e-android/updates - Thanks to #NullNoname for providing the update site.