Upgrading gradle breaks exoplayer on build, can't find core or dash - android-studio

Android studio
Gradle version: 4.1
Android plugin version: 3.0.1
implementation 'com.google.android.exoplayer:exoplayer:2.8.4'
Build works fine. Upgrade to these versions:
Gradle version: 4.6
Android plugin version: 3.2.1
implementation 'com.google.android.exoplayer:exoplayer:2.8.4' //unchanged
Build fails with these messages:
Failed to resolve: com.google.android.exoplayer:exoplayer-core:2.8.4
Failed to resolve: com.google.android.exoplayer:exoplayer-dash:2.8.4
I've been stuck on this for a day. I can't find any reason why it should work with the old version, but not the new.

I had to add the following line to allprojects repositories.
allprojects {
repositories {
google()
jcenter()
maven { url 'https://google.bintray.com/exoplayer/' } //new line
}
}
Apparently, Exoplayer is no longer in JCenter. But, the files are still in bintray.

Here you can find explanation and temporary solution for this problem
https://github.com/google/ExoPlayer/issues/5225

you add project build.gradle
repositories {
google()
jcenter()
}
and add
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
}

Related

How to upgrade to com.android.tools.build:gradle:7.1.3 in Android Studio

I have upgrade Android Studio to the latest version shown here:-
Android Studio Bumblebee | 2021.1.1 Patch 3
Build #AI-211.7628.21.2111.8309675, built on March 16, 2022
Runtime version: 11.0.11+0-b60-7590822 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Registry: external.system.auto.import.disabled=true, debugger.watches.in.variables=false
Non-Bundled Plugins: org.jetbrains.kotlin (211-1.6.20-release-275-AS7442.40), com.android.aas (3.6.0)
once the upgrade completed I have attempted to upgrade the gradle to 7.3.1
classpath 'com.android.tools.build:gradle:7.1.3'
which appeared to complete ok
however my application build now fails with this message
Could not find com.android.tools.build:gradle:7.1.3.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.1.3/gradle-7.1.3.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.1.3/gradle-7.1.3.pom
Required by:
project :
Add google Maven repository and sync project
Open File
My project gradle resembles this
buildscript {
ext.kotlin_version = "1.6.20"
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.41'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
clicking on the link Add google Maven repository and sync project does nothing
how can I resolve this build error?
Change your maven url from
allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://jitpack.io'
}
}
}
to
allprojects {
repositories {
google()
mavenCentral()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
then press Sync Project
I had same this problem in may macbook.
I was uninstall android studio and install again update patch 2021.1.1 Patch 3.
But I don't update gradle plugin 7.1.3.
I think 7.1.3 don't found in gradle website.
https://gradle.org/releases/
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Generate Signed APK gives an error in Android Studio 3.4

Build APK and run application on external device work properly, but When I am trying to generate signed APK I got the error message
Could not find com.android.tools.lint:lint-gradle:26.4.
Here is my Project build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
//mavenCentral()
}
}
some of articles suggest to change classpath version but I think 3.4.2 is the latest version of gradle.
By updating my android studio to 3.5, problem was fixed. I don't know the reason. this one was my last chance
You should put google() as the first repo inside buildscript{}, i.e.
buildscript {
repositories {
google() //// <--- here
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
}

build.gradle dependency results in compile error

After a long time, I have updated my Android Studio environment to the latest versions, but now my project doesn't compile anymore.
The error message displayed says
Could not find com.android.tools.build:aapt2:3.4.2-5326820. Searched
in the following locations:
- https://jcenter.bintray.com/com/android/tools/build/aapt2/3.4.2-5326820/aapt2-3.4.2-5326820.pom
- https://jcenter.bintray.com/com/android/tools/build/aapt2/3.4.2-5326820/aapt2-3.4.2-5326820-windows.jar
Required by:
project :app
The only reference there is to 3.4.2 is in build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
}
but if I remove this, the project doesn't compile either.
Any hint on how I can resolve this?
I had the same problem and solved it by adding google() as a repository under allprojects in the build.gradle file:
allprojects {
repositories {
google()
jcenter()
}
}

Android build miss intellij

since today I cannot build my android project because of this error :
> Could not resolve all files for configuration ':classpath'.
> Could not find intellij-core.jar (com.android.tools.external.com-intellij:intellij-core:26.0.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/external/com-intellij/intellij-core/26.0.1/intellij-core-26.0.1.jar
Android studio 3.2.1
com.android.tools.build:gradle:3.0.1
Do you have any clue ???
Thanks a lot
Vlad
I had the same problem with a cordova-android#7.1.1 project. I read this question Android Studio - Could not find intellij-core.jar and I solved by joining more than one answer.
Premise:
Android Studio 3.2.1
Cordova Android 7.1.1
Cordova Cli 8.1.2
Resolution:
File: platforms/android/build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
...
File: platforms/android/app/build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
// Allow plugins to declare Maven dependencies via build-extras.gradle.
allprojects {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
...
File: platforms/android/CordovaLib/build.gradle
...
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
...
This solution is working to me, I hope I helped you
I have the same issues, and change to classpath 'com.android.tools.build:gradle:3.1.0' solve my issues. You can try it.
This answer is heavily based on the ionic article: https://ionic.zendesk.com/hc/en-us/articles/360005529314
This script can be added to the hooks so no need to fiddle with the platforms code manually.
Create a maven_swap.sh with the following:
#!/bin/bash
#remove jcenter
sed -i.bak '/jcenter()/d' platforms/android/CordovaLib/build.gradle
#append jcenter
sed -i.bak '/maven {/{
N
N
a\
jcenter()
}' platforms/android/CordovaLib/build.gradle
cat platforms/android/CordovaLib/build.gradle
rm platforms/android/CordovaLib/build.gradle.bak
note: sed -i.bak ensures linux & mac compatibility.
Make sure the file is executable chmod +x maven_swap.sh
Add in the config.xml the following:
<platform name="android">
<hook src="maven_swap.sh" type="before_compile" />
...
</platform>

Could not execute build using Gradle distribution

I have the following error: "Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-4.4-all.zip'."
It only occurs if I have this in my gradle file:
"classpath 'com.android.tools.build:gradle:3.1.2'"
if I switch it back to:
"classpath 'com.android.tools.build:gradle:3.0.1'"
everything works again. This started after I updated gradle and android studio today.
I have tried just about every solution in this question but nothing helped:
Gradle error: could not execute build using gradle distribution
from above:
-I tried deleting the .gradle in the user folder, and restarting android studio (I also restarted my computer after several other attempts)
-gradle build is successful, I tried invalidate caches and restart. (I tried this before deleting the .gradle, would it make a difference doing it again?)
-I tried setting gradle home to several other paths but nothing helped. If I go to my android studio folder/gradle theres a gradle-4.4 folder but not any of the previous versions that work. .gradle has both 4.4 and 4.1 though.
I tried the following gradle home paths:
C:/Program Files/Android/Android Studio/gradle/gradle-4.4
C:/Users/Joseph/.gradle/wrapper/dists/gradle-4.4-all/9br9xq1tocpiv8o6njlyu5op1/gradle-4.4
/usr/local/opt/gradle/libexec/
and path/to/gradle/libexec/
as well as the default wrapper. (which I have it set to now)
It's possible my jdk/jre are set wrong but they have been working up until now.
my project gradle:
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
jcenter()
google()
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'
}
}
allprojects {
apply plugin: "eclipse"
apply plugin: "idea"
version = '1.0'
ext {
appName = "IdlePortalDefense"
gdxVersion = '1.9.6'
roboVMVersion = '2.3.1'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
google()
}
}
project(":desktop") {
apply plugin: "java"
dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
implementation "com.badlogicgames.gdx:gdx-tools:$gdxVersion"
}
}
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
implementation project(":core")
implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
}
}
project(":ios") {
apply plugin: "java"
apply plugin: "robovm"
dependencies {
implementation project(":core")
implementation "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
implementation "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
implementation "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
implementation "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-ios"
}
}
project(":core") {
apply plugin: "java"
dependencies {
implementation "com.badlogicgames.gdx:gdx:$gdxVersion"
implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
}
}
tasks.eclipse.doLast {
delete ".project"
}
my graddle wrapper:
#Wed Apr 25 00:05:44 EDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
Thanks FF7Squirrelman for sharing the problem the solution.
For me I have also fixed the problem by updating gradle distribution from gradle-4.4-all.zip to gradle-4.7-all.zip
The problem I got is I can "Build APK" and run it on my mobile via Android Studio. However, when I generate signed APK, i got the error same as above.
Looking around the web, it sounds like there is bug on gradle-4.4 which causes the issue and I have proceed below to solve the issue as F7Squirrelman suggested:
updating gradle-wrapper.properties:
distributionUrl=https://services.gradle.org/distributions/gradle-4.7-all.zip
Go to File -> Setting -> Build,Execution and Deployment -> Compiler
Uncheck the box: Configure on Demand
It will allow the project built in gradle 4.7 and finally it solves the issue.

Resources