Error build Android in Cordova: Unspecified required by? - android

I'm trying to build my app in Cordova 5.4 using cordova run android. I'm getting this:
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find any version that matches com.android.support:support-v4:+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v4/
Required by:
:android:unspecified
I can't seem to track this one down. Look familiar?

Sorry, if this should be a comment but I don't have enough points yet to do so.
Please try to install Android Support Repository in the Android SDK Manager.
Then check whether this works
cordova build android --verbose
If it's successful,
cordova run android --verbose
Source:
https://github.com/AzureAD/azure-activedirectory-library-for-cordova/issues/6

Check for android-support-v4.jar in your project build path.

Related

Databinding + Gradle related issues with Android Studio 2.3.3

After I updated my Android Studio to v2.3.3 and with it updated the required build tools and sdk version, have been getting the following error when I run ./gradlew assemble --stacktrace:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':OpenEdXMobile'.
Could not resolve all dependencies for configuration ':OpenEdXMobile:_prodDebugApkCopy'.
Could not find com.android.databinding:baseLibrary:2.3.3.
Searched in the following locations:
file:/usr/local/android-sdk/extras/android/m2repository/com/android/databinding/baseLibrary/2.3.3/baseLibrary-2.3.3.pom
file:/usr/local/android-sdk/extras/android/m2repository/com/android/databinding/baseLibrary/2.3.3/baseLibrary-2.3.3.jar
file:/home/travis/build/edx/edx-app-android/sdk-manager/com/android/databinding/baseLibrary/2.3.3/baseLibrary-2.3.3.jar
Required by:
project :OpenEdXMobile
Could not find com.android.databinding:baseLibrary:2.3.3.
Searched in the following locations:
file:/usr/local/android-sdk/extras/android/m2repository/com/android/databinding/baseLibrary/2.3.3/baseLibrary-2.3.3.pom
file:/usr/local/android-sdk/extras/android/m2repository/com/android/databinding/baseLibrary/2.3.3/baseLibrary-2.3.3.jar
file:/home/travis/build/edx/edx-app-android/sdk-manager/com/android/databinding/baseLibrary/2.3.3/baseLibrary-2.3.3.jar
Required by:
project :OpenEdXMobile > com.android.databinding:library:1.3.1
project :OpenEdXMobile > com.android.databinding:adapters:1.3.1
Full report from Travis-CI can be found here.
Here are some relevant details:
The gradle's distribution url: distributionUrl=https://services.gradle.org/distributions/gradle-3.3-all.zip
Gradle version in my module's build.gradle is v2.3.3.
My full build.gradle is kinda big so here's the link to it.
https://github.com/edx/edx-app-android/blob/f899aeca945dea9a010af727e2b3ff1176e86f4e/build.gradle
Do mention if I have missed any details :)
Sadly I wasn't able to find a solution that worked with the settings and versions mentioned in the question.
Quick Fix:
I just had to downgrade my gradle version to v2.3.0 and everything worked just fine.
Future plan:
Will update this answer once I find a solution, for now I've mentioned the quick fix, so that the community can benefit.

Ionic2 and Facebook Login: Errors in emulating android device after installing cordova-plugin-facebook4

I have an Ionic2 app that I was hoping to install cordova-plugin-facebook4 with and setup Facebook Login. I've followed a few tutorials like this one here but I am running into issues when I try to emulate an android build.
Here is the error message:
Error: /Users/mreiter/documents/photor/photor/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugCompile'.
> Could not find com.android.support:support-v4:23.4.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
https://repo1.maven.org/maven2/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
https://jcenter.bintray.com/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
Required by:
:android:unspecified
:android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1
> Could not find com.android.support:cardview-v7:23.4.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
https://jcenter.bintray.com/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
https://jcenter.bintray.com/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
Required by:
:android:unspecified
:android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1
> Could not find com.android.support:customtabs:23.4.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
https://repo1.maven.org/maven2/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
https://jcenter.bintray.com/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
https://jcenter.bintray.com/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
Required by:
:android:unspecified
:android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Any help with this would be greatly appreciated.
I was experiencing this issue this morning. The following steps worked for me:
Started a clean Ionic 2 project
Added android platform & installed the ionic facebook wrapper as described in the docs.
Opened Android Studio, imported the project from platforms/android/
Let it load, but when it asks you to update Gradle select ignore for this project.
After that it'll 'strongly recommend' you to update Gradle, once again ignore it and it'll Android Studio will start running your Gradle and building out an APK.
You'll find that you can use ionic build android and it should work.
Also I removed all Android SDK's except Android 6.X.X (Marshmallow). Give it a try. Still not exactly sure what the issue was though.

Could not resolve all dependencies for configuration ':_armv7DebugCompile'

The following error occurs when trying to build an android app with cordova and the cordova-crosswalk plugin:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
> Could not find any version that matches com.android.support:support-v4:+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v4/
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com/android/support/support-v4/maven-metadata.xml
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com/android/support/support-v4/
Required by:
:android:unspecified
* 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: 2.918 secs
/home/remi/dev/git/gitlab/sirap-sas/tereo-mobile/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/remi/dev/git/gitlab/sirap-sas/tereo-mobile/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/remi/dev/git/gitlab/sirap-sas/tereo-mobile/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true
ERROR running one or more of the platforms: Error: /home/remi/dev/git/gitlab/sirap-sas/tereo-mobile/platforms/android/cordova/run: Command failed with exit code 1
You may not have the required environment or OS to run this project
Please notice that section:
Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
It can happen because building an android project with the crosswalk plugin try to build two apks : one for ARM, the other for x86.
The solution is to install Android Support Repository :
Open the SDK manager (from command line, type android).
Under Extras, Make sure you have Android Support Repository and Google Repository downloaded.
Update answer
Seems starting from crosswalk 16, Android Support Repository and Google Repository is not enough.
You need to install Local Maven repository for Support Libraries from Extras as well.
for me Solution was:
i updated crosswalk to #15.44.384.13
ionic browser add crosswalk#15.44.384.13
then i changed config.xml:
<preference name="xwalkVersion" value="15+" />
cuz versions "16+" - "18+" not work for me
It may be the problem when you did not include google support respository and android support repository under extras. as well as when you not update the cordova with your cordova platform.because cordova and cordova platform must be use latest version.update your Cordova with npm update cordova -g --save and cordova platform with cordova platform update platform_name(like android).
This worked for me
1.goto platforms\android\cordova-plugin-crosswalk-webview folder
2.Open .gradle file
3.find
dependencies { compile xwalkSpec }
and replace with
dependencies {
compile 'org.xwalk:xwalk_core_library:22.52.561.4'
}
**
note: 22.52.561.4 is version of crasswalk on your machine
to know it , open ionic app , chrome://inspect then
window.navigator.userAgent
This will print some lines , copy xwalk details from there
I know it's a little late to add an answer. but I faced this issue for a long time and none of these steps fixed it. If your IP is from Iran, then you should build your project with VPN on. It seems that dependencies are banned for some countries.

React Native run-android build fails

I've followed the setup guide for react-native android on Mac OS X. I have the emulator running. When I run react-native run-android I get the following:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find any matches for com.android.support:appcompat-v7:23.0.+ as no versions of com.android.support:appcompat-v7 are available.
Searched in the following locations:
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/maven-metadata.xml
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/
https://jcenter.bintray.com/com/android/support/appcompat-v7/maven-metadata.xml
https://jcenter.bintray.com/com/android/support/appcompat-v7/
Required by:
fuckoff:app:unspecified
> Could not find com.android.support:appcompat-v7:22.2.0.
Searched in the following locations:
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
file:/Users/hugo/.m2/repository/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/22.2.0/appcompat-v7-22.2.0.jar
Required by:
fuckoff:app:unspecified > com.facebook.react:react-native:0.11.0
> Could not find com.android.support:support-v4:21.0.3.
Searched in the following locations:
file:/Users/hugo/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
file:/Users/hugo/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
Required by:
fuckoff:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:drawee:0.6.1
fuckoff:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:imagepipeline:0.6.1
I have all the necessary Android SDK packages installed including the build tools and the support repository. I'm noticing that it's looking for a directory in my home called .m2, which doesn't exist. I've never needed Maven to do android development. Do I need to install it to use react-native?
Just to be absolutely safe, I tried updating the android packages using android update sdk --no-ui.
Apparently the software I installed using android weren't the most up to date. Running the update fixed the issue.

Build failed on run-android due to dependencies

Problem while running the run-android. I was facing a problem, I guess it's dude to the gradle dependencies.
I have even tried sudo, which is giving some other random error saying $ANDROID_HOME. Which isn't the problem.
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:appcompat-v7:23.0.0.
Searched in the following locations:
file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
Required by:
AwesomeProject:app:unspecified
> Could not find com.android.support:appcompat-v7:23.0.0.
Searched in the following locations:
file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
Required by:
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0
> Could not find com.android.support:support-v4:21.0.3.
Searched in the following locations:
file:/Users/iraycd/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
file:/Users/iraycd/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
Required by:
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:drawee:0.6.1
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:imagepipeline:0.6.1
* 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: 11.247 secs
Could not install the app on the device, see the error above.
Where did I go wrong?
Android Support Repository was missing installed, again followed all the steps here: https://facebook.github.io/react-native/docs/android-setup.html
https://github.com/facebook/react-native/issues/2772#issuecomment-140843907
In case, like me, nothing else you've read has worked, this worked for me:
Check in the latest snapshot of changes to your source control
Remove the project directory from your system
Check out your code from source control
npm cache clean && npm install
watchman watch-del-all
react-native start -- --reset-cache
react-native run-android
:mind-blown:
Doesn't look like you've updated your libs on your machine to the newest version. Download the new versions of the support library/appcompat and then try again
It looks like you don't have android sdk installed and/or the path to it is not set up properly. There are detailed instructions about how to do this in the android setup docs of react native, follow the instructions for Install and configure SDK.
For those encountering this problem when they attempt to simply use the Android SDK Manager (tools/android), I had to run the SDK manager as root (e.g. sudo ./tools/android) to get around this error.
Unfortunately, running an X11-forwarded program as root can sometimes bring about its own issues. If you encounter problems trying to run the SDK manager as root, see this answer here. Specifically, I was able to run the SDK manager as my normal user, but attempting to run as root always failed.
It looks like you don't have android sdk installed and/or the path to it is not set up properly. There are detailed instructions about how to do this in the android setup docs of react native, follow the instructions for Install and configure SDK.

Categories

Resources