Could not find com.android.support:appcompat-v7:23.1.1 - android

I checked out and built the project at https://github.com/kosiara/artoolkit-android-studio-example
I have Android Studio 4.0.2 on Windows 10.
The build error I get is:
Executing tasks: [:app:assembleDebug] in project D:\Downloads\artoolkit-android-studio-example-master\artoolkit-android-studio-example-master
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':base'.
> Could not resolve all dependencies for configuration ':base:_debugCompile'.
> Could not find com.android.support:appcompat-v7:23.1.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.1.1/appcompat-v7-23.1.1.jar
Required by:
artoolkit-android-studio-example-master:base: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: 1.346 secs
I'm afraid I don't understand what is wrong.
I'm not sure what needs to be set to version 23.1.1. I looked in my Android SDK manager under SDK Tools, Android SDK Build-Tools and there is no option for 23.1.1. (Is that even where I should be looking?) I see 23.0.1, 23.0.2 (Installed), 23.0.3. Also the Android SDK Platform 23 is installed.
Do I need to add a custom Site to get the missing 23.1.1 option? I have no idea how to do that or what site it would be, if that's what's required.
I suspect there's likely something not set up correctly about my SDK or Android Studio, but I don't know what to check next.
I see this related question but that question has no answer.
I'd like some help getting this example to build.

That version of that module (appcompat-v7) is not in the JCenter repository.
You have to add google maven using the old way when you're using an old version of Gradle, you are not allowed to use google() on Gradle v1.5.
build.gradle (project level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Related

Could not resolve org.webkit:android-jsc:+

I'm getting an error every time I try to run 'react-native run-android' or './gradlew bundleRelease' for my React Native project.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:collectReleaseDependencies'.
> Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
> Could not resolve org.webkit:android-jsc:+.
Required by:
project :app
> Failed to list versions for org.webkit:android-jsc.
> Unable to load Maven meta-data from https://jcenter.bintray.com/org/webkit/android-jsc/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/org/webkit/android-jsc/maven-metadata.xml'.
> Read timed out
* 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.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2m 37s
Here's my build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "29.0.3"
minSdkVersion = 24
compileSdkVersion = 30
targetSdkVersion = 30
supportLibVersion = "28.0.0"
googlePlayServicesAuthVersion = "16.0.1"
}
repositories {
google()
mavenCentral()
mavenCentral()
}
dependencies {
classpath 'com.facebook.react:react-native:0.12.+'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
// expo-camera bundles a custom com.google.android:cameraview
url "$rootDir/../node_modules/expo-camera/android/maven"
}
maven { url 'https://maven.google.com' }
maven { url 'https://www.jitpack.io' }
google()
jcenter()
}
}
I can't find any an information about why this is happening bar adding 'www.' to 'https://www.jitpack.io' but it already has that.
'react-native run-android' was working yesterday, since then I changed emulator and also changed java version.
Does anyone know why this is happening?
JCenter is going to shutdown and now is READ-ONLY. And it is getting offline often causing issues with builds and pipelines.
In summary
You will require to update your android/build.gradle file to use mavenCentral() instead of Jcenter().
As per Gradle documentation, JCenter is a mirror of Maven Central, so all of your dependencies should be there.
JCenter is a central artifact repository, like Maven Central. Software
projects use JCenter to distribute their software to other people.
JCenter also serves as a mirror for Maven Central, so any dependencies
available on Maven Central are also available on JCenter (but not vice
versa).
A few things to consider:
In case it is a library (e.g node_modules/react-native-appsflyer), pointing to Jcenter, that is giving you an error... I would advise you to check the library giving you an error has updated a new version with a fix. In case so, update to the new
version to get the changes.
In case the library doesn't have versions with the fix, if you are building in React-native using npm packages, you could potentially take advantage of patch-package library. Because there will a possibility the libraries have not yet released the update removing JCenter from build.gradle.
Applying the patch
You can apply the changes yourself using the Patch Package library. Documentation added in the end for reference.
Go to node_modules/library-with-error/android/build.gradle
Change jcenter() to mavenCentral()
Run: npx patch-package library-with-error
Git add, commit and push
Personal notes:
I did advise the full removal of JCenter instead of adding MavenCentral() to the top because of the shutdown and that JCenter is often getting offline and giving timeout errors.
Based on the current timeline, builds that use JCenter will be able to
resolve dependencies until February 1, 2022 without changes. After
that date, there are no guarantees that you will be able to build
your software if you continue to use JCenter."
Also, Gradle is discouraging the usage of JCenter.
"To discourage new projects from using JCenter, we will be removing
JCenter from our samples and init templates. The new default will be
Maven Central. Gradle itself has no inherent tie to JCenter or Maven
Central, so you can always switch any other repository of your choice.
This change will be effective with the next Gradle release – Gradle
7.0."
In case of dependencies (pom, jar) are not added to Maven, here are instructions on how to add. Add that to the PR with discussions to collaborate.
Useful Links
Add --use-yarn to patch-package command in case your project uses Yarn.
Documentation using Patch package.
We also just ran into this. I believe JCenter is down right now. https://status.bintray.com/

React Native - Run Android - Could not find common.jar (android.arch.core:common:1.0.0) [duplicate]

This question already has answers here:
Error:Failed to resolve: android.arch.core:common:1.1.0
(5 answers)
Closed 4 years ago.
When run react-native run-android, I got this error :
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-device-info'.
> Could not find common.jar (android.arch.core:common:1.0.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/common/1.0.0/common-1.0.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I found this solution and works for me:
add maven { url "https://maven.google.com" } in line 18 in file android/build.gradle
If you are using jcenter() and maven {url "https://maven.google.com"} make sure that maven {url "https://maven.google.com"} is written first (upper in code).
android.arch.core:common:1.0.0 exists in jcenter(), but doesn't have .jar file there and thats why build fails. Using Google Maven first fixes this problem, because .jar exist there.
allprojects {
repositories {
maven { url 'https://maven.google.com' } // <--- This needs to be before jcenter().
jcenter()
}
}
In my case, it was a network issue with my Wifi (proxy...). Try to switch network with mobile data for example.
I updated my root projects build gradle version and all the support libraries to latest version and its working now, you can check it go through, build.gradle(root project) -> buildscript -> dependencies-> classpath->
classpath 'com.android.tools.build:gradle:3.your_latest_version'
also make sure your compileSdkVersion and buildToolsVersion are latest
and once check version of distributionUrl also from gradle-wrapper.properties file

Jenkins Android Gradle build time download error

Linux environment using jenkins android gradle project to build an error
* What went wrong:
A problem occurred configuring project ':app'.
> Could not download glide.jar (com.github.bumptech.glide:glide:3.7.0)
> Could not get resource 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/3.7.0/glide-3.7.0.jar'.
> Could not GET 'https://jcenter.bintray.com/com/github/bumptech/glide/glide/3.7.0/glide-3.7.0.jar'.
> repo.jfrog.org: unknown error
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
I tried to use the wget way to download the link will prompt an error, then I use the sudo way to download the link successfully. So, how can I make jenkins gradle also use the sudo download, or use other solutions
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
// Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please help me, thanks.
You can try upload your local library (in user/.gradle/caches) to Jenkins server, It 's work for me.
I don't think that run the build with super user rights is a good solution, because it's not seems to be possible to resolve dependencies.
Just a suggestion how to solve it: Gradle has it's own local cache for dependencies and doesn't need to download them on every build. So you may use the same Gradle distribution, which is used by Jenkins, and once build your application manually with su rights, to resolve all dependencies and cache them.
Just to note, by default dependencies with dynamic versions are cached for 24 hours only, as it's said in the official docs, but you can change it as:
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 10, 'minutes'
resolutionStrategy.cacheChangingModulesFor 4, 'hours'
}

Build Android APK in Redhat using Gradle in Offline mode

I am using Gradle 2.13 and trying to build android apk in readhat and system does not have internet access.
I am trying to build android apk offline. But it is throwing some exception and not able to figure out what went wrong.
Main build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'PROJECT'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:2.1.0.
Required by:
:PROJECT:unspecified
> No cached version of com.android.tools.build:gradle:2.1.0 available for offline mode.
> No cached version of com.android.tools.build:gradle:2.1.0 available for offline mode.
* 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: 0.831 secs
Version :
gradle -version
Gradle 2.13
Is there any tutorial available to build an offline apk in redhat/linux machine?
Edit: Update the question.
It happens because the gradle plugin for android 2.13 doesn't exist.
The latest stable version is 2.1.0. Use:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
Don't confuse gradle distribution and the android plugin for gradle.
You can define the gradle distribution used by a project in the file
gradle/wrapper/gradle-wrapper.properties
For example:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

gradle: Could not find com.android.support:multidex:1.0.1

when I use gradle(version 2.1 or 2.4) building Android Project, get the error below. I can not find com.android.support:multidex:1.0.1 in my files.
ERRORS:
config is set to BF688C717A5C3A69FE8CA522643C0A68
config is set to PRODUCT
vcode is set to 151
vname is set to 1.5.1
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':XXXX'.
Could not resolve all dependencies for configuration
':yizhangtong:_rendepeng_lmDebugCompile'.
Could not find com.android.support:multidex:1.0.1.
Searched in the following locations:
.............
* 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: 30.178 secs
You need to install "Android Support Repository" from the Android SDK manager. (a.k.a extra-android-m2repository if installing from the command line)
**OR**
You need to install "Android Support Library(Obsolete)" from the Android SDK manager.
This issue exists in Android studio Beta versions
The only solution is to use
repositories {
maven {
url 'https://maven.google.com'
}
}
in project gradle file
Installing both Android Support Library and Local Maven Repository for Support Libraries from the Android SDK manager (Extras section) fixed this issue for me.
If you are using Android SDK command line tools, type:
sdkmanager "extras;android;m2repository"
The SDK manager will install the m2 repository
try compile 'com.android.support:multidex:1.0.0'
I fixed it by adding google() in allprojects node on top-level build.gradle file. Here is my top level file for reference
buildscript {
repositories {
jcenter()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}

Categories

Resources