Gradle Fails to implement com.mapbox.maps:android:10.2.0 - android

I need to import import com.mapbox.maps.plugin.annotation.generated.PointAnnotationOptions; in my app code, for that I need to implement com.mapbox.maps:android:10.2.0 in build.gradle module, but it fails.
Could someone tell me, why this gradle implement fails to resolve?
implementation ('com.mapbox.maps:android:10.2.0'){
exclude group: 'group_name', module: 'module_name'
}
This is the error msg:
Failed to resolve: com.mapbox.maps:android:10.2.0
In stack trace it says: NotFound com.mapbox.maps:android:10.2.0
Show in Project Structure dialog
Affected Modules: app
build.gradle (project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication{
basic(BasicAuthentication)
}
credentials{
username='mapbox'
password= project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?:""
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ERROR INFORMATION

After a a few hours of research I came to find out how to properly set up Mapbox (10.0.2) on Android
IMO, this first bullet should solve the issue, otherwise keep going.
First, in settings.gradle -> as stated previously set mode to PREFERS.SETTINGS .
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven {
url 'https://api.mapbox.com/downloads/v2/releases/maven'
authentication {
basic(BasicAuthentication)
}
credentials {
// Do not change the username below.
// This should always be `mapbox` (not your username).
username = "mapbox"
// Use the secret token you stored in gradle.properties as the password
password = MAPBOX_DOWNLOADS_TOKEN
}
}
}
}
Second, add the dependency as per usual to module-level build.gradle (not project level)
implementation 'com.mapbox.maps:android:10.2.0'
Third, this is what my project-level build.gradle looks like.
buildscript {
ext {
compose_version = '1.2.0-alpha02'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Last, in your gradle.property make sure you have
(GOOD) MAPBOX_DOWNLOADS_TOKEN = SECRET_ACCESS_CODE
(DO NOT) MAPBOX_DOWNLOADS_TOKEN = "SECRET_ACCESS_CODE"

Related

How to add Mopub ads in android studio

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.

Gradle failed to download com.google.android.gms play-services-ads/15.0.0/play-services-ads.pom

i am trying to add admob banner ads to an android app..But when i put
"implementation'com.google.android.gms:play-services-ads:15.0.0'" in dependencies the gradle failed to download it ..
Anny help
// 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.0.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
}
Use implementation 'com.google.android.gms:play-services-ads:15.0.1' and not 15.0.0
Also share some more detail so we can provide more accurate answer

Android Studio importing Jetbrains Exposed

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'
}

Android studio 3.0 - Cant run app

So far i only worked on the computer from my job and today im trying to setup my project on my home computer but no luck so far.
I guess it has to with gradle configurations or android studio 3.0 but the settings are the same for both computers, i get no errors but cant click the run button, adding run configuration doesnt work either.
My gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
mavenLocal()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha6'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
maven { url 'http://github.com/wada811/Android-Material-Design-Colors/raw/master/repository/' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I dont know if this will help but my gradle.build is this for my apps. Maybe try using mine? Or an upgrade on your android studio, I know the earlier ones have bugs. The newer versions always seem to run more smoothly
// 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'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

I am not able to sync my android project as it was build on another PC. How to solve it?

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript [poiu{
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
buildscript **[poiu**{
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Pay attention to the code wrapped in * - the code there should be purely buildscript without the [poui at all.
As to how this happened; It might be copy-paste error(paste in wrong place) or it might be accidental code writing. The point is to fix it. Gradle build errors are not as detailed and the IDE does not show error in the same way the java(or C++ etc) compilers and IDE's show them.

Categories

Resources