I am trying to integrate Mopub ads into my Android Studio project, but I am encountering an error when building the project. I have followed the instructions provided in the link (https://developers.mopub.com/publishers/android/integrate/#option-3-cloned-github-repository), but I am still unsure how to resolve the error. The error message is:
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method implementation() for arguments [com.mopub:mopub-sdk:#aar, build_2jh7i72qxdht1wclzb0v2ink0$_run_closure1$_closure3$_closure5#13b54e85] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Here is my build.gradle file for reference:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.google.gms:google-services:4.3.3'
implementation('com.mopub:mopub-sdk:#aar') {
transitive = true
}
// NOTE: Do not place your application dependencies here; they belon
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The implementation('com.mopub:mopub-sdk:5.13.1#aar') goes into your app's (not project's) build.gradle.
Related
I would like to open ten https://github.com/mukundmadhav/Wordpress-to-Android-app project in Android Studio. However, I have a problem.
I'm getting errors
ERROR: Could not find com.android.tools.build:gradle:3.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.jar
Required by:
project :
Add Google Maven repository and sync project
Open File
I tried to solve the problem with these methods
Gradle 4.1 issue on latest android studio 3.0.1
Could not find com.android.tools.build:gradle:3.0.1
Could not find com.android.tools.build.gradle:3.0.0-alpha7
However, nothing helped, does anyone know how to open this project?
Update:
Android Version 3.4.1
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.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" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
There should be google() repo in repositories which searches plugins/libraries in google repository.
Also, version number for com.android.tools.build should match the Android Studio Version. For example: for Android studio 3.4.1, classpath dependency should be:
classpath 'com.android.tools.build:gradle:3.4.1'
Here is the modified code for build.gradle.
// 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.4.1'
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Check if google() is present in repositories in the top level build.gradle
allprojects {
repositories {
jcenter()
google()
}
}
P.S - If you're using Android Studio 3.1 or higher, you should be able to click on Add Google Maven repository and sync project and allow Android Studio to make the necessary corrections by itself and resync the gradle.
I tried to build my ionic application on Android using Capacitor. But when I tried to build and run an application on android studio, it gives this error. I don't have any android studio knowledge. The error:
Could not find method allprojects() for arguments [build_al8rrgnflynwtjpadzojip71i$_run_closure1#68017a4f] on settings 'android' of type org.gradle.initialization.DefaultSettings.
The build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Instead of allprojects in root project gradle, there is another repositories block in dependencyResolutionManagement, which worked for me.
I reinstalled my android studio and thereafter i am getting error while building gradle.
I did every change that can help in building gradle but then also it showed error as "configure build" error.
so kindly help me so that i can start my android programming.
gradle version - 4.4
android plugin version - 3.1.3`
i have changed google() to maven() but nothing happened.
//build.gradle file
// Top-level build file where you can add configuration options common to all
sub-projects/modules.
buildscript {
repositories {
google()
jcenter { url 'http://jcenter.bintray.com' }
}
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()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am new to Android development. I have created a new project with Android Studio and need to import jetbrains exposed library into my existing project. When I tried to follow the exposed Getting Started guide to add the following into the build.grade file:
repositories {
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
dependencies {
compile 'org.jetbrains.exposed:exposed:0.10.2'
}
I get the following error:
Could not find method compile() for arguments [org.jetbrains.exposed:exposed:0.10.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I have been searching the internet for a couple of days now but still could not find out what's the problem.
This is the build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.40'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
repositories {
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
dependencies {
compile 'org.jetbrains.exposed:exposed:0.10.2'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Hopefully someone could help me.
Thanking in advance.
You should put this dependency in the module level build.gradle file - by default, this is in the app folder, as opposed to the project level build.gradle file, which is in the root of your project.
Also, you should use implementation instead of compile, since you're using a newer than 3.0 version of the Android Gradle plugin:
repositories {
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
dependencies {
implementation 'org.jetbrains.exposed:exposed:0.10.2'
}
I have been trying to add the firebase performance dependency, I followed
Get Started with Firebase Performance Monitoring for Android
guide
I have added in the top gradle file the classpath 'com.google.firebase:firebase-plugins:1.1.0' and the jcenter() repository.
But I am getting the following error that the com.google.firebase:firebase-plugins:1.1.0 dependency cannot be found.
Also I have the latest version of the google play services(40) and the google repository(51) installed.
Here is my top build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.google.firebase:firebase-plugins:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is the error message:
Error:Could not find com.google.firebase:crash-plugin:1.1.0. Searched in the following locations:
file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/firebase/crash-plugin/1.1.0/crash-plugin-1.1.0.pom
file:/Applications/AndroidStudio.app/Contents/gradle/m2repository/com/google/firebase/crash-plugin/1.1.0/crash-plugin-1.1.0.jar
https://jcenter.bintray.com/com/google/firebase/crash-plugin/1.1.0/crash-plugin-1.1.0.pom
https://jcenter.bintray.com/com/google/firebase/crash-plugin/1.1.0/crash-plugin-1.1.0.jar Required by: project : > com.google.firebase:firebase-plugins:1.1.0
Unfortunately the plugin was not yet approved on bintray.
It has now been approved, so if you try again it should work!