Android multi module implement private libs with maven authentication - android

I'm modularizing a project and encountering a gradle issue that I can't seem to fix. In this project, I'm implementing private libraries from gradle:
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://gitlab.com/api/xxx/-/packages/maven"
credentials(HttpHeaderCredentials) {
name = "Private-Token"
value = gitlabToken
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
I replace this code from build.gradle project by this code on setting.gradle.kts :
val properties = java.util.Properties()
val inputStream = java.io.FileInputStream("gradle.properties")
properties.load(inputStream)
val gitlabToken = properties.getProperty("gitlab_token")
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
jcenter()
mavenCentral()
maven {
url = java.net.URI("https://gitlab.com/api/v4/xxxx/-/packages/maven")
credentials(HttpHeaderCredentials::class) {
name = "Private-Token"
value = gitlabToken
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
}
}
When I run my project, I have this error :
FAILURE: Build completed with 8 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':core:commons:generateDevDebugRFile'.
> Could not resolve all files for configuration ':core:commons:devDebugCompileClasspath'.
> Failed to transform mylib-1.0.0.aar (com.libs:mylib:1.0.0) to match attributes {artifactType=android-symbol-with-package-name, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-api}.
> Could not find mylib-1.0.0.aar (com.libs:mylib:1.0.0).
Searched in the following locations:
https://gitlab.com/api/xxx//-/packages/maven/com/libs/mylib/1.0.0/mylib-1.0.0.aar
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':core:commons:generateDevDebugRFile'.
...
Can you tell me what I need to modify in my gradle files to be able to implement these libraries in my modules?

Related

AppDynamics adeum plugin insecure protocol error

I'm experiencing a problem while using adeum plugin with insecure nexus repositories. While executing gradle tasks, the following error rises.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:dataBindingMergeDependencyArtifactsAlphaRelease'.
> Could not resolve all dependencies for configuration ':app:alphaReleaseRuntimeClasspath'.
> Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven_adeum(http://***.***.***.***:8081/repository/maven-public/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.4.1/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details.
Project level build.gradle:
buildscript {
repositories {
maven { url "http://***.***.***.***:8081/repository/maven-public/"; setAllowInsecureProtocol(true) }
maven { url "http://***.***.***.***:8081/repository/google-maven2-proxy/"; setAllowInsecureProtocol(true) }
maven { url "http://***.***.***.***:8081/repository/developer-huawei/"; setAllowInsecureProtocol(true) }
}
}
...
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.appdynamics:appdynamics-gradle-plugin:22.8.0'
...
}
...
allprojects {
repositories {
maven { url "http://***.***.***.***:8081/repository/maven-public/"; setAllowInsecureProtocol(true) }
maven { url "http://***.***.***.***:8081/repository/google-maven2-proxy/"; setAllowInsecureProtocol(true) }
maven { url "http://***.***.***.***:8081/repository/developer-huawei/"; setAllowInsecureProtocol(true) }
}
}
App level build.gralde:
plugins {
id 'com.android.application'
id 'adeum'
...
}
...
dependencies {
implementation 'com.appdynamics:appdynamics-runtime:22.8.0'
...
}

Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0. on fresh installation of MapBox

I set up a fresh react-native project and added Mapbox with yarn add #react-native-mapbox-gl/maps.
This
Notice, that if you're using the default Mapbox Android SDK (which is packed in with this lib)
and are on newer Android OS version (API 30+),
you'll encounter Fatal Exception: java.lang.SecurityException: getDataNetworkTypeForSubscriber.
is not applicable as far as I understand, because I am aiming at API 29 on Android. Plus, it is not the error I am getting.
I added the democode provided
import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import MapboxGL from '#react-native-mapbox-gl/maps';
MapboxGL.setAccessToken('<YOUR_ACCESSTOKEN>');
const styles = StyleSheet.create({
page: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF'
},
container: {
height: 300,
width: 300,
backgroundColor: 'tomato'
},
map: {
flex: 1
}
});
export default class App extends Component {
render() {
return (
<View style={styles.page}>
<View style={styles.container}>
<MapboxGL.MapView style={styles.map} />
</View>
</View>
);
}
}
and started the App on Android. I get the following this error:
Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0.
Required by:
project :react-native-mapbox-gl_maps > com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0
Search in build.gradle files
This is app/android/build.gradle
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
ndkVersion = "20.1.5948944"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.1")
}
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven {
url("$rootDir/../node_modules/react-native/android")
}
maven {
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
maven { url 'https://www.jitpack.io' }
}
}
FAILURE: Build completed with 8 failures.
1: Task failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugAssets'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
- file:/Users/macosx/.m2/repository/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
- file:/Users/macosx/Documents/mapstar-current/MapStar/node_modules/react-native/android/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
- file:/Users/macosx/Documents/mapstar-current/MapStar/node_modules/jsc-android/dist/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
- https://dl.google.com/dl/android/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
- https://www.jitpack.io/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
Required by:
project :app > project :react-native-mapbox-gl_maps > com.mapbox.mapboxsdk:mapbox-android-sdk:9.1.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
When I click on the link provided
https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
I get a 404...
I am not sure why (maybe because react-native-mapbox-gl is being updated), this needs to be added to your code:
Add the following to your android/build.gradle under section allprojects/repositories
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 = project.properties['MAPBOX_DOWNLOADS_TOKEN'] ?: ""
}
}
Got this hint from here https://github.com/react-native-mapbox-gl/maps/issues/1501#issuecomment-906158991
Adding this line in my app/build.gradle file and rebuilding solved the problem for me:
allprojects {
repositories {
...
jcenter()
}
}

FAILURE: Build failed with an exception. Execution failed for task ':app:compileDebugKotlin'

When I run the flutter project on the android emulator I got this error log.
This error log comes when I run any flutter project.
Don't know what happens. Any help?
This is the error log (What went wrong):
Execution failed for task ':app:compileDebugKotlin'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Could not download flutter_embedding_debug.jar (io.flutter:flutter_embedding_debug:1.0.0-40441def692f444660a11e20fac37af9050245ab)
> Could not get resource 'https://storage.flutter-io.cn/download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-40441def692f444660a11e20fac37af9050245ab/flutter_embedding_debug-1.0.0-40441def692f444660a11e20fac37af9050245ab.jar'.
> Tag mismatch!
> Could not download x86_debug.jar (io.flutter:x86_debug:1.0.0-40441def692f444660a11e20fac37af9050245ab)
> Could not get resource 'https://storage.flutter-io.cn/download.flutter.io/io/flutter/x86_debug/1.0.0-40441def692f444660a11e20fac37af9050245ab/x86_debug-1.0.0-40441def692f444660a11e20fac37af9050245ab.jar'.
> Tag mismatch!
> Could not download x86_64_debug.jar (io.flutter:x86_64_debug:1.0.0-40441def692f444660a11e20fac37af9050245ab)
> Could not get resource 'https://storage.flutter-io.cn/download.flutter.io/io/flutter/x86_64_debug/1.0.0-40441def692f444660a11e20fac37af9050245ab/x86_64_debug-1.0.0-40441def692f444660a11e20fac37af9050245ab.jar'.
> Tag mismatch!
This is my project-level build.gradle file
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

How to add maven.fabric.io/public to artifactory/nexus and download passthrough io.fabric.tools:gradle?

Is available build.gradle
buildscript {
repositories {
maven { url 'http://artifactory/artifactory/repo' }
maven { url 'http://artifactory/artifactory/remote-repos' }
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:latest.release"
classpath 'io.fabric.tools:gradle:1.29.0'
....
}
}
allprojects {
repositories {
maven { url 'http://artifactory/artifactory/repo' }
maven { url 'http://artifactory/artifactory/remote-repos' }
}
}
}
He gives an error.
When trying to add https://maven.fabric.io/public to artifactory, an error is thrown.
Has anyone encountered such an error? And how can it be fixed?
FAILURE: Build failed with an exception.
* What went wrong:
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve io.fabric.tools:gradle:1.29.0.
Required by:
project :
> Could not resolve io.fabric.tools:gradle:1.29.0.
> Could not get resource 'http://artifactory/artifactory/repo/io/fabric/tools/gradle/1.29.0/gradle-1.29.0.pom'.
I added https://maven.fabric.io/public to artifactory. It is work

An error occurred evaluating root project .Could not create plugin of type 'AppPlugin'

I have 18 applications which I am trying to execute using Gradle.
I have tried Gradle(1.6,1.8.1.9,1.10)
While executing I am getting this error :
BUILD FAILED
Total time: 3.817 secs
D:\ABC\DEF>gradle build
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\ABC\DEF\build.gradle' line: 10
* What went wrong:
A problem occurred evaluating root project 'ABC'.
> Could not create plugin of type 'AppPlugin'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 6.536 secs
My build.gradle file is :
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.6.3'
classpath 'de.felixschulze.gradle:gradle-app-plugin:1.1+'
}
}
apply plugin: 'android'
apply plugin: 'App'
repositories {
mavenCentral()
}
dependencies {
compile project(':libraries:NavigationDrawer')
compile project(':libraries:google-play-services_lib')
compile files('libs/android-rome-feed-reader-1.0.0-r2.jar')
compile files('libs/gcm.jar')
compile files('libs/gson-2.2.2.jar')
debugCompile files('libs/SDK-3.0.0.jar')
compile files('libs/jdom-1.1.1-android-fork.jar')
compile files('libs/libGoogleAnalyticsV2.jar')
}
/*
* upload to vette2 server
*/
task uploadToVette2(type: Exec) {
commandLine './scripts/uploadToVette2.sh'
}
/*
* upload to app server
* will pass a paramter named:note
* we can call it like this: gradle uploadToApp -Pnote="some note here"
*/
task uploadToApp(type: Exec) {
commandLine './scripts/uploadToApp.sh'
if (project.hasProperty("note")){
args note
}
}
app {
apiToken = "19b1ba1d36ab4299a09a302f34169fe1"
releaseType = 2 // alpha
notify = 0
status = 2
notesType = 1
notes = "Some notes."
symbolsDirectory = file("build/symbols/")
mappingFileNameRegex = "R.txt"
}
android {
defaultConfig {
minSdkVersion 9
targetSdkVersion 9
}
compileSdkVersion 17
buildToolsVersion "17.0.0"
productFlavors {
tigers {
packageName "com.xx.aa"
}
bb {
packageName "com.xx.bb"
}
cc {
packageName "com.xx.cc"
}
and so on.
Thanks for your replies

Categories

Resources