Add Google ExoPlayer to Android studio gradle build - android-studio

If i have an Android app developed using Android Studio is it possible to link the ExoPlayer library (https://github.com/google/ExoPlayer) straight from github using graddle?
It would be handy not to manually have to download the library and copy it into my project every time it's updated by the ExoPlayer team.
I have tried adding this to the build.gradle in my module.
repositories {
mavenCentral()
maven { url 'https://raw.github.com/google/ExoPlayer' }
}
dependencies {
compile 'com.google.android.exoplayer'
}
But i get an error about the module notation being invalid...

It is now possible to add ExoPlayer as a jCenter dependency via gradle!
repositories {
mavenCentral()
jcenter()
}
dependencies {
...
compile 'com.google.android.exoplayer:exoplayer:r1.4.1'
}

Related

A problem occurred configuring project ':game'. > java.lang.NullPointerException (no error message)

I'm building apk from an android project exported from Cocos Creator V2.4.3 but getting the below error with Gradle
A problem occurred configuring project ':game'.
> java.lang.NullPointerException (no error message)
I've deleted all android SDK, NDK and re-installed Android Studio, then re-update SDK, NDK, Build Tool.
But the error still occurs.
Some configurations:
Android SDK = 23, 26, 28, 30
SDK Build Tool = 30.0.3
NDK = 19.2.5345600
Gradle version: 4.10.3
Gradle plugin version: 3.2.0
JDK: jdk1.8.0_281
The build.gradle looks like this
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Anyone has any idea about what should be done to fix this?
I had the same issue, I solved this by specifying 3.6.3 as Android Gradle plugin version and 5.6.4 as Gradle version.
You can do this by clicking File--> project structure--> project then type the versions I mentioned above then click on apply.
wait for the new versions to be downloaded and rebuild your project.
The problem was with setting the NDK Path in Cocos Creator.
I've changed
C:\Users\SomeUserName\AppData\Local\Android\Sdk\ndk
into
C:\Users\SomeUserName\AppData\Local\Android\Sdk\ndk\19.2.5345600
And things worked

Can't update the Android Gradle Plugin

I am running Android Studio 3.4.1 and I'm trying to build a bundle.
Build -> Build Bundle(s) / APK(s) -> Build Bundle(s)
And here is what I see:
When I click Update, the dialog dismisses and absolutely nothing happens. I have tried several times.
I also have this:
I am very new to Android Studio, but my simple app is complete and ready to deploy to the Google Play Store. Is there some alternate way to build a bundle? Am I missing something?
First make sure in your current plugin google() is included.
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
...
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
Second - Update values in distributionURL gradle-wrapper.properties and sync
distributionUrl = https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl path could be found at following path

Could not find com.android.tools.build:gradle:3.1.3

I am using Android Studio 3.0.1 and I have updated the Gradle plugin from 4.1 to 4.4 and also tried to upgrade the android plugin Gradle from 3.0.1 to 3.1.3. The problem is AS cannot update the android plugin and gives me this error.
Error:Could not find com.android.tools.build:gradle:3.1.3.
Searched in the following locations:
file:/F:/android studio/gradle/m2repository/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.pom
file:/F:/android studio/gradle/m2repository/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.pom
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar
https://maven.google.com/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.pom
https://maven.google.com/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.1.3/gradle-3.1.3.jar
Based on the same questions I've added maven repo in Project level build.gradle in addition to google() used for AS 3.0 and higher but the problem hasn't been solved.
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
try alter and verify that in the "gradle-wrapper.properties" file to amend the gradle dist to a much later version for example
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
and also update the android support lib version to latest version as well for eg 27.1.1
Make sure you have "Enable embedded Maven repository" checked (in Prefrences / Settings menu)

Android studio with api.ai lib

I trying to use api.ai in a android project. So I download the Android Studio 2.3.3 create a new blank project to use android 5.0 o higher so I go here and put the dependencies
compile 'ai.api:sdk:2.0.7#aar'
// api.ai SDK dependencies
compile 'com.android.support:appcompat-v7:23.2.1'
But only to put the dependencies I got the error:
Error:(9, 0) Gradle DSL method not found: 'compile()' Possible
causes:The project 'ChefBot' may be using a version of the
Android Gradle plug-in that does not contain the method (e.g.
'testCompile' was added in 1.1.0). Upgrade
plugin to version 2.3.3 and sync projectThe project
'ChefBot' may be using a version of Gradle that does not contain the
method. Open Gradle wrapper
fileThe build file may be missing a Gradle plugin. Apply Gradle plugin
How can I fix this?
this is my build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.application' // put this and don`t work
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
compile 'ai.api:sdk:2.0.7#aar'
compile 'com.android.support:appcompat-v7:23.2.1'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

failed to resolve: com.google.android.gms: play-services-games: 6.5+

This project has been working for weeks. Yesterday, Android Studio pulled in some updates, and now gradle cannot find my play-services files. It has literally stopped building with no changes to the project - I didn't think this would happen with a gradle-based project.
gradle sync error
When I click on "Install Repository and sync project", another window opens with the message:
Ignoring unknown package filter 'extra-google-m2repository'Warning: The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
Here is my gradle file:
apply plugin: 'android-library'
repositories {
mavenCentral()
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services-games:6.5+'
compile 'com.google.android.gms:play-services-plus:6.5+'
compile 'com.google.android.gms:play-services-appstate:6.5+'
}
android {
compileSdkVersion 20
buildToolsVersion '20'
}
Looking in my SDK manager, both "Google Repository" and "Android Support Repository" are installed.
SDK manager screen shot
It is possible that I have two different SDK's, but not sure how to tell if I do, and not sure how to remove the extra one if this is the issue.
Removing the "+" and specifying the specific version allows me to build again. I'm actually using 6.5.87, as 8.4.0 caused some other issue.

Resources