I am installing react-native-navigation I get this error when compiling. do you know how to solve it?
* Where:
Build file '/Users/userprueba/Documents/project-react-native/node_modules/react-native-navigation/lib/android/app/build.gradle' line: 151
* What went wrong:
A problem occurred configuring project ':react-native-navigation'.
> It is too late to set sourceCompatibility
It has already been read to configure this project.
Consider either moving this call to be during evaluation,
or using the variant API.
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 34s
this is enviroment
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-navigation": "^6.4.0",
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
RNNKotlinVersion = "1.3.61"
buildToolsVersion = "31.0.0"
minSdkVersion = 21
compileSdkVersion = 31
targetSdkVersion = 31
//playServicesVersion = "17.0.0"1
if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
ndkVersion = "24.0.8215888"
} else {
// Otherwise we default to the side-by-side NDK version from AGP.
ndkVersion = "21.4.7075529"
}
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61")
//classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.61"
classpath("com.android.tools.build:gradle:7.2.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath 'com.google.gms:google-services:4.3.3'
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
mavenCentral()
maven { url 'https://www.jitpack.io' }
}
}
android/app/build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
import org.apache.tools.ant.taskdefs.condition.Os
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://reactnative.dev/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
enableHermes: true, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and that value will be read here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
/**
* Architectures to build native code for.
*/
def reactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.xxxxxxx"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
if (isNewArchitectureEnabled()) {
// We configure the CMake build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
cmake {
arguments "-DPROJECT_BUILD_DIR=$buildDir",
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
"-DANDROID_STL=c++_shared"
}
}
if (!enableSeparateBuildPerCPUArchitecture) {
ndk {
abiFilters (*reactNativeArchitectures())
}
}
}
}
if (isNewArchitectureEnabled()) {
// We configure the NDK build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
cmake {
path "$projectDir/src/main/jni/CMakeLists.txt"
}
}
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
into("$buildDir/react-ndk/exported")
}
def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
into("$buildDir/react-ndk/exported")
}
afterEvaluate {
// If you wish to add a custom TurboModule or component locally,
// you should uncomment this line.
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
// Due to a bug inside AGP, we have to explicitly set a dependency
// between configureCMakeDebug* tasks and the preBuild tasks.
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
configureCMakeDebug.dependsOn(preDebugBuild)
reactNativeArchitectures().each { architecture ->
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
dependsOn("preDebugBuild")
}
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
dependsOn("preReleaseBuild")
}
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include (*reactNativeArchitectures())
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
//noinspection GradleDynamicVersion
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
exclude group:'com.facebook.fbjni'
}
} else {
implementation jscFlavor
}
}
if (isNewArchitectureEnabled()) {
// If new architecture is enabled, we let you build RN from source
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
// This will be applied to all the imported transtitive dependency.
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("com.facebook.react:react-native"))
.using(project(":ReactAndroid"))
.because("On New Architecture we're building React Native from source")
substitute(module("com.facebook.react:hermes-engine"))
.using(project(":ReactAndroid:hermes-engine"))
.because("On New Architecture we're building Hermes from source")
}
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.implementation
into 'libs'
}
apply from: file("../../node_modules/#react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
def isNewArchitectureEnabled() {
// To opt-in for the New Architecture, you can either:
// - Set `newArchEnabled` to true inside the `gradle.properties` file
// - Invoke gradle with `-newArchEnabled=true`
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}
tried this but it did not work:
1-. rm -rf ~/Library/Developer/Xcode/DerivedData 2-. rm -rf Podfile.lock 3-. pod install
and
npx rnn-link
and
validate the configuration in android
https://wix.github.io/react-native-navigation/docs/installing/#android
Related
I have an Android Studio (3.4.1) cocos2d-x project with multiple modules. My settings.gradle file defines the 3 modules:
include ':libcocos2dx'
project(':libcocos2dx').projectDir = new File(settingsDir, '../cocos2d/cocos/platform/android/libcocos2dx')
include ':ToaTetrisApp'
project(':ToaTetrisApp').projectDir = new File(settingsDir, 'app')
include ':gameCircleSDK'
NOTE: gameCircleSDK does not need its projectDir set because the directory matches the module name inside proj.android
The problem I have is that when I build a release build of the application OR I try to Build->Generate Signed Bundle / APK I get the following error:
>Task :ToaTetrisApp:transformClassesAndResourcesWithR8ForRelease FAILED
AGPBI: {"kind":"error","text":"Program type already present: com.amazon.ags.BuildConfig","sources":[{}],"tool":"D8"}
NOTE: com.amazon.ags.BuildConfig is an auto-generated class for the gameCircleSDK module. The AndroidManifest.xml for gameCircleSDK defines package="com.amazon.ags" and this is the only place that the package is defined.
I also searched my generated files and found only the expected BuildConfig.java files in the release folders: com.toa.tetris (ToaTetrisApp), com.amazon.ags (gameCircleSDK), org.cocos2dx.lib (cocos2d-x)
I have the following build.gradle files:
proj.android: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'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
buildDir = "C:/tmp/${rootProject.name}/${project.name}"
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
proj.android:app:build.gradle [ToaTetrisApp]
import org.gradle.internal.os.OperatingSystem
apply plugin: 'com.android.application'
android {
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
defaultConfig {
applicationId "com.toa.tetris"
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 21
versionName "4.5.1"
multiDexEnabled true
externalNativeBuild {
if (PROP_BUILD_TYPE == 'ndk-build') {
ndkBuild {
targets 'MyGame'
arguments 'NDK_TOOLCHAIN_VERSION=clang'
//arguments 'V=1'
arguments '-j' + Runtime.runtime.availableProcessors()
def module_paths = [project.file("../../cocos2d").absolutePath,
project.file("../../cocos2d/cocos").absolutePath,
project.file("../../cocos2d/external").absolutePath]
if (OperatingSystem.current().isWindows()) {
module_paths = module_paths.collect {it.replaceAll('\\\\', '/')}
arguments 'NDK_MODULE_PATH=' + module_paths.join(";")
}
else {
arguments 'NDK_MODULE_PATH=' + module_paths.join(':')
}
}
}
else if (PROP_BUILD_TYPE == 'cmake') {
cmake {
targets 'MyGame'
arguments "-DCMAKE_FIND_ROOT_PATH=", "-DANDROID_STL=c++_static", "-DANDROID_TOOLCHAIN=clang", "-DANDROID_ARM_NEON=TRUE"
cppFlags "-frtti -fexceptions -fsigned-char"
}
}
}
ndk {
abiFilters = []
abiFilters.addAll(PROP_APP_ABI.split(':').collect{it as String})
}
}
sourceSets.main {
java.srcDir "src"
res.srcDir "res"
manifest.srcFile "AndroidManifest.xml"
assets.srcDir "../../Resources"
}
externalNativeBuild {
if (PROP_BUILD_TYPE == 'ndk-build') {
ndkBuild {
path "jni/Android.mk"
}
}
else if (PROP_BUILD_TYPE == 'cmake') {
cmake {
path "../../CMakeLists.txt"
}
}
}
signingConfigs {
release {
<CONTENT REMOVED>
}
debug {
<CONTENT REMOVED>
}
}
buildTypes {
release {
debuggable false
jniDebuggable false
renderscriptDebuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (project.hasProperty("RELEASE_STORE_FILE")) {
signingConfig signingConfigs.release
}
externalNativeBuild {
ndkBuild {
arguments 'NDK_DEBUG=0'
}
}
}
debug {
debuggable true
jniDebuggable true
renderscriptDebuggable true
externalNativeBuild {
ndkBuild {
arguments 'NDK_DEBUG=1'
}
}
}
}
}
android.applicationVariants.all { variant ->
// delete previous files first
delete "${buildDir}/intermediates/assets/${variant.dirName}"
variant.mergeAssetsProvider.get().doLast {
copy {
from "${buildDir}/../../../Resources"
into "${buildDir}/intermediates/assets/${variant.dirName}"
exclude "**/*.gz"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation fileTree(dir: '../gameCircleSDK/libs', include:['*.jar'])
implementation project(':libcocos2dx')
implementation project(':gameCircleSDK')
}
proj.android:gameCircleSDK:build.gradle
apply plugin: 'com.android.library'
android {
signingConfigs {
debug {
<CONTENT REMOVED>
}
}
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
//buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
}
sourceSets.main {
manifest.srcFile "src/main/AndroidManifest.xml"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
//implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'], exclude: [])
}
proj.android:..:cocos2d:cocos:platform:android:libcocos2dx:build.gradle
apply plugin: 'com.android.library'
android {
signingConfigs {
debug {
<CONTENT REMOVED>
}
}
compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger()
defaultConfig {
minSdkVersion PROP_MIN_SDK_VERSION
targetSdkVersion PROP_TARGET_SDK_VERSION
versionCode 1
versionName "1.0"
}
sourceSets.main {
aidl.srcDir "../java/src"
java.srcDir "../java/src"
manifest.srcFile "AndroidManifest.xml"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: '../java/libs', include: ['*.jar'])
}
I have been searching and found many recommendations and tried many of them to no avail. Here are some of the things I've tried:
I tried File->Invalidate Caches / Restart: NOTE: I originally had the same problem with my debug build and run and this is the solution that resolved that issue.
I have tried running 'gradlew ToaTetrisApp:dependencies' and I don't see any reference to com.amazon.ags nor any duplicates. I'm not sure I fully understand the output, but it seems for the debug, release and tests the dependencies seem to be as expected
I have, of course, tried to clean and rebuild many times, but to no avail
I have added 'multiDexEnabled true' to my app:build.gradle file. I'm not sure whether this really did anything or whether I added it to the correct file. This didn't seem to resolve the issue
I have tried to add 'afterEvaluate { generateReleaseBuildConfig.enabled = false }', but again, I wasn't sure which build.gradle to add this to so I couldn't get it to work
I'm hoping that someone can provide some explanation of what exactly this error means and how I can track down and resolve this issue myself. This project doesn't use a lot of external dependencies so I would expect that it would be easy to track down what is going on exactly and why this error shows up. If you would like to offer some suggestions then please let me know which gradle file you would like me to add the code to as that is often not mentioned.
I'm able to build the debug version of my react-native app. However, when I try to build the release apk, I get the following error:
Execution failed for task ':blelibrary:verifyReleaseResources'.
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource
linking failed Output:
/Users/someguy/projects/third/someapp/android/blelibrary/build/intermediates/res/merged/release/values-v26/values-v26.xml:7:
error: resource android:attr/colorError not found.
followed by a ton of messages that look like this:
Command:
/Users/someguy/.gradle/caches/transforms-1/files-1.1/aapt2-3.5.0-alpha03-5252756-osx.jar/8bd335ec556ebe5abcc696b2317758fe/aapt2-3.5.0-alpha03-5252756-osx/aapt2
link -I\
/Users/someguy/Library/Android/sdk/platforms/android-24/android.jar\
--manifest\
app build gradle looks like this
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.oliveapp"
minSdkVersion 19
targetSdkVersion 28
multiDexEnabled true
versionCode 35
versionName "1.3.5"
ndk {
abiFilters "armeabi-v7a", "x86"
}
packagingOptions {
exclude "lib/arm64-v8a/libgnustl_shared.so"
}
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_static'
}
}
}
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
debug {
debuggable true
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
externalNativeBuild {
cmake {
path 'CMakeLists.txt'
}
}
dexOptions {
jumboMode true
}
}
dependencies {
implementation project(':react-native-i18n')
implementation project(':react-native-svg')
implementation project(':react-native-extra-dimensions-android')
implementation project(':react-native-google-analytics-bridge')
implementation project(':react-native-splash-screen')
implementation project(':react-native-image-picker')
implementation project(':react-native-spinkit')
implementation project(':react-native-fbsdk')
implementation project(':react-native-picker')
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'com.facebook.react:react-native:+'
// From node_modules
implementation 'com.facebook.fresco:fresco:2.0.0'
implementation 'com.facebook.fresco:animated-gif:2.0.0'
implementation project(':blelibrary')
implementation project(':gaialibrary')
implementation project(':vmupgradelibrary')
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation project(':react-native-connectivity-status')
implementation('com.google.android.gms:play-services-basement:17.0.0')
implementation('com.google.android.gms:play-services-base:17.0.0')
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation("androidx.annotation:annotation:1.1.0")
implementation("androidx.appcompat:appcompat:1.1.0-rc01")
implementation("androidx.vectordrawable:vectordrawable-animated:1.1.0-rc01")
implementation("androidx.fragment:fragment:1.1.0-rc01")
implementation("androidx.vectordrawable:vectordrawable:1.1.0-rc01")
implementation("androidx.lifecycle:lifecycle-viewmodel:2.1.0-rc01")
implementation("androidx.core:core:1.1.0-rc01")
implementation("androidx.lifecycle:lifecycle-runtime:2.1.0-rc01")
implementation("androidx.arch.core:core-common:2.1.0-rc01")
implementation("androidx.lifecycle:lifecycle-common:2.1.0-rc01")
implementation("androidx.versionedparcelable:versionedparcelable:1.1.0-rc01")
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
repositories {
}
buildscript {
repositories {
maven { url 'https://github.com/500px/500px-android-blur/raw/master/releases/' }
google()
}
dependencies {
}
}
// apply plugin: 'com.google.gms.google-services'
after running ./gradlew assembleRelease --info
I saw this message:
> > Task :app:externalNativeBuildRelease Task ':app:externalNativeBuildRelease' is not up-to-date because: Task
> has not declared any outputs. externalNativeBuildRelease: starting
> build externalNativeBuildRelease: reading expected JSONs
> externalNativeBuildRelease: done reading expected JSONs
> externalNativeBuildRelease: executing build commands for targets that
> produce .so files or executables externalNativeBuildRelease: evaluate
> miniconfig externalNativeBuildRelease: evaluate library
> lib_someappfitting-Release-armeabi-v7a externalNativeBuildRelease: not
> building target lib_someappfitting because there was no build command
> for it externalNativeBuildRelease: evaluate library
> someappfittingjni-Release-armeabi-v7a externalNativeBuildRelease:
> building target library someappfittingjni because no targets are
> specified. externalNativeBuildRelease: about to build
> /Users/someguy/Library/Android/sdk/cmake/3.6.4111459/bin/cmake --build
> /Users/someguy/projects/third/someapp-app/android/app/.externalNativeBuild/cmake/release/armeabi-v7a
> --target someappfittingjni externalNativeBuildRelease: evaluate miniconfig externalNativeBuildRelease: evaluate library
> lib_someappfitting-Release-x86 externalNativeBuildRelease: not
> building target lib_someappfitting because there was no build command
> for it externalNativeBuildRelease: evaluate library
> someappfittingjni-Release-x86 externalNativeBuildRelease: building
> target library someappfittingjni because no targets are specified.
> externalNativeBuildRelease: about to build
> /Users/someguy/Library/Android/sdk/cmake/3.6.4111459/bin/cmake --build
> /Users/someguy/projects/third/someapp-app/android/app/.externalNativeBuild/cmake/release/x86
> --target someappfittingjni Build someappfittingjni x86 externalNativeBuildRelease: Executable :
> /Users/someguy/Library/Android/sdk/cmake/3.6.4111459/bin/cmake
> arguments :
> --build /Users/someguy/projects/third/someapp-app/android/app/.externalNativeBuild/cmake/release/x86
> --target someappfittingjni
Add the following to the android build.gradle:
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28 // have to match with build.gradle and app/build.gradle ones
buildToolsVersion '28.0.3' // have to match with build.gradle and app/build.gradle ones
variantFilter { variant ->
def names = variant.flavors*.name
// To check for a certain build type, use variant.buildType.name == "<buildType>"
if (names.contains("reactNative51") || names.contains("reactNative55") || names.contains("reactNative56")) {
// Gradle ignores any variants that satisfy the conditions above.
setIgnore(true)
}
}
}
}
}
}
Check out this page for more details
Can any one help me out on this my app is multidex enabled and I am having issue on the android version 5 and below 5 my app is crashing due to the classnot found exception infact the class is present still.`
My Gradle file is -
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
repositories {
maven {
url 'http://repo.brightcove.com/releases'
}
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.weone.android"
minSdkVersion 16
targetSdkVersion 23
versionCode 31
versionName "1.2.2"
multiDexEnabled true
}
signingConfigs {
release {
storeFile file('/home/user/AndroidStudioProjects/WeOneWithExoPlayer/weone-android/certificate/WeOne.jks')
storePassword 'WeOneKey'
keyAlias 'weone'
keyPassword 'WeOneKey'
}
debug {
storeFile file('/home/user/.android/debug.keystore')
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries = false
}
buildTypes {
debug {
// signingConfig signingConfigs.debug
}
release {
minifyEnabled false
//shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.release
// multiDexKeepFile file 'multidex-config.txt'
}
}
/* afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = []
}
dx.additionalParameters += '--multi-dex' // enable multidex
// optional
// dx.additionalParameters += "--main-dex-list=$projectDir/<filename>".toString() // enable the main-dex-list
}
}*/
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.squareup.retrofit2:retrofit:2.2.0') {
exclude module: 'okhttp'
}
compile 'com.squareup.retrofit2:converter-gson:2.2.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.squareup.okhttp3:okhttp:3.+'
compile 'com.squareup.okhttp3:logging-interceptor:3.+'
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
compile('org.eclipse.paho:org.eclipse.paho.android.service:1.0.2') {
exclude module: 'support-v4'
}
compile 'com.android.support:multidex:1.0.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.naver.android.helloyako:imagecropview:1.0.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'joda-time:joda-time:2.9.2'
compile 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.0.2'
compile 'com.daimajia.swipelayout:library:1.2.0#aar'
compile 'com.android.support:multidex-instrumentation:1.0.1'
compile 'com.theartofdev.edmodo:android-image-cropper:2.2.+'
compile 'com.google.guava:guava:19.0'
compile 'com.brightcove.player:exoplayer:4.+'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.facebook.network.connectionclass:connectionclass:1.0.1'
compile 'com.plattysoft.leonids:LeonidsLib:1.3.2'
compile 'com.android.support:appcompat-v7:25.+'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.android.support:design:25.+'
compile 'com.android.support:cardview-v7:25.+'
compile 'com.android.support:recyclerview-v7:25.+'
compile 'com.android.support:support-v4:25.+'
compile 'com.github.jd-alexander:LikeButton:0.2.0'
compile 'com.turbomanage.basic-http-client:http-client-android:0.89'
compile 'com.google.apis:google-api-services-youtube:v3-rev182-1.22.0'
compile 'com.google.android.gms:play-services-ads:10.+'
compile 'com.google.android.gms:play-services-gcm:10.+'
compile 'com.google.android.gms:play-services:10.+'
compile 'com.hbb20:ccp:1.7.2'
compile 'com.google.android.gms:play-services-auth:10.+'
compile 'com.google.api-client:google-api-client-android:1.22.0'
configurations {
compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile 'com.googlecode.libphonenumber:libphonenumber:7.1.1'
compile 'com.android.support:animated-vector-drawable:25.+'
compile 'com.android.support:customtabs:25.+'
compile 'com.android.support:mediarouter-v7:25.+'
}
And Project Gradle is -
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
repositories {
mavenCentral()
jcenter()
}
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
mavenCentral()
maven {
url 'http://lorenzo.villani.me/android-cropimage/'
}
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
maven {
url "https://repo.eclipse.org/content/repositories/paho-releases/"
}
}
}
My app is crashng below 5 and I am stuck in it from last 2 weeks.
Haven't got solution till now. :(
stacktrace ---------------------------------------------------
04-06 16:10:33.314 21020-21020/com.weone.android E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.weone.android, PID: 21020
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/api/client/extensions/android/http/AndroidHttp;
at com.weone.android.utilities.helpers.constants.Config.<clinit>(Config.java:26)
at com.weone.android.utilities.helpers.constants.Config.setAppModeConfig(Config.java:0)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.initThings(ApplicationProperties.java:59)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.access$000(ApplicationProperties.java:29)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties$1.run(ApplicationProperties.java:44)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.onCreate(ApplicationProperties.java:51)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1035)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)
at android.app.ActivityThread.access$1500(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.api.client.extensions.android.http.AndroidHttp" on path: DexPathList[[zip file "/data/app/com.weone.android-1/base.apk", zip file "/data/app/com.weone.android-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.weone.android-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.weone.android.utilities.helpers.constants.Config.<clinit>(Config.java:26)
at com.weone.android.utilities.helpers.constants.Config.setAppModeConfig(Config.java:0)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.initThings(ApplicationProperties.java:59)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.access$000(ApplicationProperties.java:29)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties$1.run(ApplicationProperties.java:44)
at com.weone.android.utilities.helpers.apporganizer.ApplicationProperties.onCreate(ApplicationProperties.java:51)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1035)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4638)
at android.app.ActivityThread.access$1500(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1378)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5343)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
Suppressed: java.lang.ClassNotFoundException: com.google.api.client.extensions.android.http.AndroidHttp
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 18 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I tried to adapt following template: deckard-gradle
I use Android Studio 0.8.14 (beta).
This is my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'robolectric'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 18
targetSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
androidTest {
setRoot('src/test')
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'LICENSE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
robolectric {
include '**/*Test.class'
exclude '**/espresso/**/*.class'
}
configurations {
apt
}
apt {
arguments {
resourcePackageName android.defaultConfig.packageName
androidManifestFile variant.outputs[0].processResources.manifestFile
}
}
ext {
daggerVersion = '1.2.2';
androidAnnotationsVersion = '3.2';
robobindingVersion = '0.8.9';
jodatimeVersion = '2.5.1';
ormliteVersion = '4.48';
ottoVersion = '1.3.5';
commonsioVersion = '2.0.1';
playservicesVersion = '6.1.71';
supportv4Version = '21.0.2';
javaxinjectVersion = '1';
junitVersion = '4.11';
robolectricVersion = '2.4';
}
dependencies {
// Espresso
androidTestCompile files('libs/espresso-1.1.jar', 'libs/testrunner-1.1.jar', 'libs/testrunner-runtime-1.1.jar')
androidTestCompile 'com.google.guava:guava:14.0.1'
androidTestCompile 'com.squareup.dagger:dagger:1.2.2'
androidTestCompile 'org.hamcrest:hamcrest-integration:1.1'
androidTestCompile 'org.hamcrest:hamcrest-core:1.1'
androidTestCompile 'org.hamcrest:hamcrest-library:1.1'
androidTestCompile("junit:junit:${junitVersion}") {
exclude module: 'hamcrest-core'
}
androidTestCompile("org.robolectric:robolectric:${robolectricVersion}") {
exclude module: 'classworlds'
exclude module: 'commons-logging'
exclude module: 'httpclient'
exclude module: 'maven-artifact'
exclude module: 'maven-artifact-manager'
exclude module: 'maven-error-diagnostics'
exclude module: 'maven-model'
exclude module: 'maven-project'
exclude module: 'maven-settings'
exclude module: 'plexus-container-default'
exclude module: 'plexus-interpolation'
exclude module: 'plexus-utils'
exclude module: 'wagon-file'
exclude module: 'wagon-http-lightweight'
exclude module: 'wagon-provider-api'
}
androidTestCompile 'com.squareup:fest-android:1.0.+'
apt "org.robobinding:codegen:$robobindingVersion"
compile("org.robobinding:robobinding:$robobindingVersion:with-dependencies") {
exclude group: 'com.google.guava', module: 'guava'
}
apt "org.androidannotations:androidannotations:${androidAnnotationsVersion}"
compile "org.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
apt "com.squareup.dagger:dagger-compiler:${daggerVersion}"
compile "com.squareup.dagger:dagger:${daggerVersion}"
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.google.android.gms:play-services:${playservicesVersion}"
compile "com.android.support:support-v4:${supportv4Version}"
compile "com.squareup:otto:${ottoVersion}"
compile "javax.inject:javax.inject:${javaxinjectVersion}"
compile "com.j256.ormlite:ormlite-core:${ormliteVersion}"
compile "com.j256.ormlite:ormlite-android:${ormliteVersion}"
compile group: 'commons-io', name: 'commons-io', version: "${commonsioVersion}"
compile "net.danlew:android.joda:${jodatimeVersion}"
}
apply plugin: 'idea'
idea {
module {
testOutputDir = file('build/test-classes/debug')
}
}
android.applicationVariants.all { variant ->
def aptOutput = file("${project.buildDir}/generated/source/apt/${variant.dirName}")
println "****************************"
println "variant: ${variant.name}"
println "manifest: ${variant.processResources.manifestFile}"
println "aptOutput: ${aptOutput}"
println "****************************"
variant.javaCompile.doFirst {
println "*** compile doFirst ${variant.name}"
aptOutput.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.apt.getAsPath(),
'-AandroidManifestFile=' + variant.processResources.manifestFile,
'-s', aptOutput
]
}
}
I tried to ways to run unit tests:
When I use gradlew test I get exceptions because all tests (also instrumentation) are executed.
When I use Android Studio to run a JUnit test I get this error:
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
at junit.runner.BaseTestRunner.<init>(BaseTestRunner.java:5)
at junit.textui.TestRunner.<init>(TestRunner.java:54)
at junit.textui.TestRunner.<init>(TestRunner.java:48)
at junit.textui.TestRunner.<init>(TestRunner.java:41)
at com.intellij.rt.execution.junit.JUnitStarter.junitVersionChecks(JUnitStarter.java:190)
at com.intellij.rt.execution.junit.JUnitStarter.canWorkWithJUnitVersion(JUnitStarter.java:173)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Process finished with exit code -3
For various reasons, I've abandoned the above approach in favor of keeping my Robolectric tests in a Gradle submodule. You can find a blog post I wrote about why I moved in this direction and a fork of the deckard-gradle project that shows you how here.
I want to upload my artifacts to a remote Nexus repo. Therefore I have configured a snaphot and a release repo in Nexus. Deployment to both works.
Now I want to configure my build so I can decide in which repo I want to deploy:
gradle uploadArchives should deploy to my snapshots repo
gradle release uploadArchives should deploy to my release repo
This was my try:
apply plugin: 'war'
apply plugin: 'maven'
group = 'testgroup'
version = '2.0.0'
def release = false
repositories {
mavenCentral()
mavenLocal()
}
dependencies{ providedCompile 'javax:javaee-api:6.0' }
task release <<{
release = true;
println 'releasing!'
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "http://.../nexus/content/repositories/releases"){
authentication(userName: "admin", password: "admin123")
}
addFilter('lala'){ x, y -> release }
}
mavenDeployer {
repository(url: "http://.../nexus/content/repositories/snapshots"){
authentication(userName: "admin", password: "admin123")
}
addFilter('lala'){ x, y ->!release}
pom.version = version + '-SNAPSHOT'
}
}
}
The build works if I comment out one of the two mavenDeployer configs, but not as a whole.
Any ideas how to configure two target archives in one build file?
One solution is to add an if-else statement that adds exactly one of the two deployers depending on the circumstances. For example:
// should defer decision until end of configuration phase
gradle.projectsEvaluated {
uploadArchives {
repositories {
mavenDeployer {
if (version.endsWith("-SNAPSHOT")) { ... } else { ... }
}
}
}
}
If you do need to vary the configuration based on whether some task is "present", you can either make an eager decision based on gradle.startParameter.taskNames (but then you'll only catch tasks that are specified as part of the Gradle invocation), or use the gradle.taskGraph.whenReady callback (instead of gradle.projectsEvaluated) and check whether the task is scheduled for execution.
Correct me if I'm wrong, but shouldn't you use the separate snapshotRepository in this case (as opposed to an if statement)? For example,
mavenDeployer {
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
}