I am trying to run the Signal app from Android studio, but I have the following error :
A problem occurred evaluating root project 'Signal'.
> Could not find method content() for arguments [build_ln9dya767x5ojwb6lu9wg470$_run_closure1$_closure2$_closure4$_closure5#1a6eaf53] on object of type org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRepository.
The concerned line is content and is found in the build.gradle file :
buildscript {
repositories {
google()
mavenCentral()
jcenter {
content {
includeVersion 'org.jetbrains.trove4j', 'trove4j', '20160824'
includeGroupByRegex "com\\.archinamon.*"
}
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
}
}
Related
I want to publish some subproject to maven by using maven-publish plugin. The current Gradle script looks like this.
apply plugin: 'maven-publish'
group "com.huawei.quickapp"
version "1.0-SNAPSHOT"
publishing {
publications {
publishTask(MavenPublication) {
}
}
repositories {
maven {
url = uri("${rootDir}/local_repo/repos/")
}
}
}
}
static Boolean publishIfNeeded(taskName){
println("name = " + taskName)
def list = ["baselibrary", "corelibrary"]
if (taskName in list) {
return true
}
return false
}
I just want two libraries,core and base to be published. When I submitted the code to the pipeline, the CI suggested that the NDK version did not match, but there was no NDK-related configuration in my code. The upgrade is necessary because only versions greater than 3.6 support the use of From Components.Debug or some other build variable in gradle script.I tried configuring the build script for Subproject separately like this:
buildscript {
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.5.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
subprojects {
buildscript {
ext.kotlin_version = "1.4.21"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
}
}
}
but it still not work. I got this error
Could not get unknown property 'Debug' for SoftwareComponentInternal set of type org.gradle.api.internal.component.DefaultSoftwareComponentContainer.
Is there a way to publish a submodule using the buildScripte of a submodule? thx.
I am using "auth-retrofit" and that problem I face it,
and I can't understand where is the problem and why that's my Gradle code and that's the shown error.
"" Build file 'C:\Users\Ammar\AndroidStudioProjects\user-auth-retrofit\build.gradle' line: 7
A problem occurred evaluating root project 'user-auth-retrofit'.Could not find method google() for arguments [] on repository container.""
here's my Build gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I use Gradle Kotlin DSL and in my project I have separate build-dependencies gradle module which is included in settings.gradle.kts like so:
pluginManagement {
repositories {
google()
jcenter()
gradlePluginPortal()
}
}
includeBuild("build-dependencies")
This module contains empty plugin implementation and Deps object. Its build.gradle.kts below:
repositories {
google()
jcenter()
gradlePluginPortal()
}
plugins {
`kotlin-dsl`
`java-gradle-plugin`
}
gradlePlugin {
plugins.register("com.example.dependencies") {
id = "com.example.dependencies"
implementationClass = "com.example.dependencies.DependenciesPlugin"
}
}
Deps object:
object Deps {
const val buildTools = "com.android.tools.build:gradle:4.1.1"
// more dependencies
}
I want to use this Deps object in all modules by applying the plugin in build.gradle.kts files.
plugins {
id("com.example.dependencies")
}
And it works fine, I can import and use Deps object.
But there is a problem when I want to use it in root projects build.gradle.kts and more precisely in buildscript like so:
buildscript {
repositories {
google()
jcenter()
}
plugins {
id("com.example.dependencies")
}
dependencies {
classpath(com.example.dependencies.Deps.buildTools) // It doesn't work
}
}
Is there any way to use a custom plugin inside buildscript like this or could you suggest something to replace this approach?
I also wonder this. However, I think this is the difference between includeBuild and buildSrc.
I've copied exactly what the kotlin gradle docs say to implement kotlin gradle plugin, however it's returning the following error:
Could not find method kotlin() for arguments [gradle-plugin, 1.3.20] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
my gradle
buildscript {
ext.kotlin_version = '1.3.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath(kotlin("gradle-plugin", version = "1.3.20"))
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
// ext {
// navigationVersion = '28.0.0'
// }
plugins {
kotlin("<...>")
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Any idea?
build.gradle can be written in Groovy or Kotlin. You're typing your build.gradle in Groovy (not Kotlin), but you have copied the Kotlin code. You should select the Groovy tab on the documentation:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.3.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
}
}
Here: https://kotlinlang.org/docs/reference/using-gradle.html#targeting-android
You can also find a decent example by creating an empty Android and Kotlin project.
I'm getting error while trying to Add the dependencies of the navmii sdk
I'm following the documentation to add the dependencies:
http://navmii.com/android-sdk-documentation/
In order to add the SDK library to your application insert the following code into your app’s build.gradle:
repositories {
maven {
url 'TODO'
}
}
dependencies {
compile ('com.navmii.android:navmiisdk:1.0.0.36167#aar') // TODO update the version
}
i got error massage says : Error:(18, 0) Could not find method compile() for arguments [com.navmii.android:navmiisdk:1.0.0.36167#aar] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
My gradle.build file :
buildscript {
repositories {
google()
jcenter()
repositories {
maven {
url 'TODO'
}
}}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
compile ('com.navmii.android:navmiisdk:1.0.0.36167#aar')
// 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
}
What's the problem ?