Include AdView library with gradle - java

I have my android project, and this is my part of my gradle file as explained in tutorial here
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
compile project(':engine')
compile project(':android')
compile 'com.google.android.gms:play-services-ads:11.2.0'
}
However after doing this, I still can't seem to include AdView object. It just doesn't seem to import.

Related

Could not find com.android.tools.build:gradle:4.0.1. - android

I'm using Android Studio Dolphin | 2021.3. I want to get gradle 4.0.1 but I got this:
Could not find com.android.tools.build:gradle:4.0.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
- https://jcenter.bintray.com/com/android/tools/build/gradle/4.0.1/gradle-4.0.1.pom
Required by:
project :
Add google Maven repository and sync project
Open File
build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
gradle-wrapper.properties:
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip

Could not resolve in adding HMS Huawei repos in gradle

im trying to integrate in HMS Huawei, in adding classpath im have error:
Could not resolve com.huawei.agconnect:agcp:1.6.0.300.
my build.gradle:
buildscript {
repositories {
google()
jcenter()
maven {url 'https://developer.huawei.com/repo/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'com.google.gms:google-services:4.3.8'
classpath 'com.huawei.agconnect:agcp:1.6.0.300'
}
}
allprojects {
repositories {
google()
jcenter()
repositories {
maven { url 'http://dl.bintray.com/swallowsonny/ext/' }
maven { url 'https://jitpack.io' }
maven { url 'https://developer.huawei.com/repo/' }
}
}
}
my gradle ver: 6.7.1 and gradle plugin ver: 4.1.3
Try this:
Go to File -> Project Settings -> Gradle and uncheck the Gradle offline work option.
Synchronize the project again and let all the dependencies get downloaded.
I have corrected settings.gradle like this:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter()
maven {url 'https://developer.huawei.com/repo/'} // add this line
}
}

Android Studio Error "lint-gradle-api-26.1.2 not found

When I run my App, AS comes up with this error. Says that the file was not found at https://repo.jfrog.org/artifactory/libs-release-bintray/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar?referrer. Please help! Putting google() repo doesn't work.
I ran into this issue as well. Basically, the issue is that mentioned jar file is no longer in jcenter. I resolved by changing the order of search in our app build.gradle:
buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}

Intellij IDEA doesn't resolve Gradle dependencies

I'm using Intellij IDEA 2017.2.4 and Gradle 4.0.1
I have few Spring Boot services. And I facing a problem to run them, they can fail while starting in a random way because of missing dependencies.
I have a parent project with build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://plugins.gradle.org/m2/" }
mavenLocal()
}
dependencies {
classpath("io.spring.gradle:dependency-management-plugin:$dependencyManagementPluginVersion")
classpath("org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion")
}
}
allprojects {
apply plugin: 'java'
apply plugin: 'idea'
group = '***'
version = '***'
}
subprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8
processResources {
filesMatching('**/*.yml') {
expand(project.properties)
}
}
apply plugin: 'io.spring.dependency-management'
dependencyManagement {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:$springCloudVersion")
mavenBom("org.springframework.boot:spring-boot-dependencies:$springBootVersion")
}
dependencies {
dependency "com.google.cloud:google-cloud-storage:$googleCloudStorageVersion"
...
dependency "org.junit.jupiter:junit-jupiter-api:$junitVersion"
}
}
}
And a child project build.gradle:
apply plugin: 'org.springframework.boot'
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
mavenLocal()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-jpa')
...
testCompile('com.h2database:h2')
}
In some cases lombok dependency is missed, in other javax dependency. It shows that dependencies are not there.
But after I press Refresh All Gradle Projects and build once again it works.
Maybe someone encountered the same issue and have some solution for it?
It seems that you have problem with lombok dependency. First step is to ensure that lombok is added as your compile time dependency for example:
repositories {
mavenCentral()
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.16.18'
}
Second step is to ensure that you have newest lombok plugin installed on your Intellij. It is very important when you are trying to compile your project inside IDE. Another thing that may help is setting to autoupdate dependencies in Intellij configuration.

occurred evaluating root project > plugin with com.android.application not found

Downloaded an android project having a problem I have this in a gradle file...
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.21.5'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
But I am getting the error..
Plugin with id 'com.android.application' not found
Any ideas what the problem is?
try in root gradle:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// 2.1.2 is newest plugin but required studio >= 2.1
classpath 'com.android.tools.build:gradle:1.5.0'
// The Fabric Gradle plugin uses an open ended version to react
// quickly to Android tooling updates
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
in app or lib gradle:
apply plugin: 'com.android.application'
//Put Fabric plugin after Android plugin
apply plugin: 'io.fabric'
for fabric version plugin see:
https://s3.amazonaws.com/fabric-artifacts/repo/io/fabric/tools/gradle/maven-metadata.xml
<latest>1.21.5</latest>
<release>1.21.6</release>
btw don't use plus sign in libs/classes it's slows down the build process: instead classpath 'io.fabric.tools:gradle:1.+' use -> classpath 'io.fabric.tools:gradle:1.21.6'

Categories

Resources