Android studio not publishing artifact to Artifactory - android-studio

I'm facing an odd problem with Android Studio and Artifactory. I want to publish a module from Android Studio. The problem being, the build info is published just fine but the artifacts are not published.
build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.5.4"
}
}
allprojects {
apply plugin: "com.jfrog.artifactory"
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
artifactory {
contextUrl = "${artifactory_contextUrl}"
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
}
module/build.gradle
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
def packageName = 'x.x'
def libraryVersion = 'v1.0.0'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 10000
versionName libraryVersion
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
publishing {
publications {
aar(MavenPublication) {
groupId packageName
version = libraryVersion
artifactId "y"
artifact("$buildDir/outputs/aar/$archivesBaseName-release.aar")
}
}
}
artifactory {
publish {
defaults {
publications('aar')
publishArtifacts = true
publishBuildInfo = false
publishPom = true
publishIvy = false
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
When I run ./gradlew assembleRelease artifactoryPublish from the terminal, I always get the following output:
> Task :minecommon:artifactoryPublish
Deploying build descriptor to: https://artifactory-domain/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under https://artifactory-domain/artifactory/webapp/builds/project-name/1509633107114
BUILD SUCCESSFUL in 2s
26 actionable tasks: 1 executed, 25 up-to-date
I can find the build in the "Build Browser" of my Artifactory.
Is there something wrong with my configuration? How can I make gradle publish my artifacts?
I've tries every article I could find on this issue to no resolve.

Related

Flutter build error : Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'

I try to build apk in my flutter application. I am got one warning and one error. Warning message : Your Flutter application is created using an older version of the Android embedding. It's being deprecated in favor of Android embedding v2.
Error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
> Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\Abdulkadhar\Documents\Android\AppDevelopment\Production\simply2be_production\build\app\intermediates\flutter\debug\libs.jar.
> Transform's input file does not exist: C:\Users\Abdulkadhar\Documents\Android\AppDevelopment\Production\simply2be_production\build\app\intermediates\flutter\debug\libs.jar. (See https://issuetracker.google.com/issues/158753935)
* 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 4m 1s
Running Gradle task 'assembleRelease'... 243.1s (!)
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1
My app gradle
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '2'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 29
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "app.projects.xxx.xxxx"
minSdkVersion 19
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
minifyEnabled true
useProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
flutter {
source '../..'
}
//apply plugin: 'com.android.application'
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'com.google.firebase:firebase-core'
}
apply plugin: 'com.google.gms.google-services'
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}}
My build gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'//4.0.0'//3.3.2 //3.5.3 //3.4.2
classpath 'com.google.gms:google-services:4.3.2'
}
}
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
}
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
}
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}}
Here are my Gradle wrapper properties in case they are also important.
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
#distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
My gradle.properties
org.gradle.jvmargs=-Xmx1536m -Duser.country=US -Duser.language=en
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true

Android Studio: Error "Failed to resolve: design"?

Hi I receive this error message on gradle project sync.
"Failed to resolve: design"
I can't find what's this.
Is there any friend that can help me with this? Or do you have another icon pack Android Studio project?
It's from CandyBar-Sample-Master android icon pack project.
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.CompileSdk
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
def appName = parent.name
def fileName = appName.replace(" ", "_")
outputFileName = "$fileName-v${variant.versionName}.apk"
}
}
defaultConfig {
applicationId "com.grafiman.icons.selero"
minSdkVersion rootProject.ext.MinSdk
targetSdkVersion rootProject.ext.TargetSdk
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.github.danimahardhika.candybar-library:core:3.5.0-b4'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
}
//NOTE: This is important
rootProject.ext {
BuildTools = "27.0.3"
MinSdk = 15
TargetSdk = 26
CompileSdk = 26
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Android Studio Wikitude Native SDK Issue

So im trying to first build a basic app using android studio and Wikitudes Native SDK to make an AR app. After following the setup instructions ive ran into an error I cant seem to solve but have an idea of why/where its happening. Does anyone know what could be causing these errors?
This image here shows the errors I am getting and what looks to be an issue with a few of the imports
Here is also a copy of my build.gradle file (Module: app), and my build.gradle file (Module: NativeSDKExamples), respectively:
apply plugin: 'com.android.application'
android {
compileSdkVersion commonCompileSdkVersion
buildToolsVersion commonBuildToolsVersion
defaultConfig {
applicationId "com.uhg.ent.mobile.lifesciences.amplify"
minSdkVersion commonMinSdkVersion
targetSdkVersion commonTargetSdkVersion
versionCode 1
versionName "7.2.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "app-" + variant.buildType.name + ".apk"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
flavorDimensions "arch"
productFlavors {
arm7 {
dimension "arch"
}
arm8 {
dimension "arch"
}
x86 {
dimension "arch"
}
allarchs {
dimension "arch"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile (name: 'wikitude-native-sdk', ext:'aar')
arm7Compile project(path: ':plugins', configuration: 'arm7Release')
arm8Compile project(path: ':plugins', configuration: 'arm8Release')
x86Compile project(path: ':plugins', configuration: 'x86Release')
allarchsCompile project(path: ':plugins', configuration: 'allarchsRelease')
compile "com.android.support:appcompat-v7:$commonSupportLibVersion"
compile "com.android.support:design:$commonSupportLibVersion"
compile "com.android.support:support-v4:$commonSupportLibVersion"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android:flexbox:0.2.5'
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
AND
// 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'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
subprojects {
ext.commonCompileSdkVersion = 26
ext.commonBuildToolsVersion = "26.0.0"
ext.commonMinSdkVersion = 19
ext.commonTargetSdkVersion = 26
ext.commonSupportLibVersion = "26.0.0"
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}

Tensorflow in Android, gradle issues

I am trying to get tensorflow in working android, kinda out of default project folder. I modified my build.gradle, but obviously I miss something, as my app crashes on runtime complying about unavailabiltity of native libraries. I have spent good few hours tring to solve this, but to no avail. Could someone help, please?
Basically, i compared .so file in APK produced by working tf demo and my .so, and they are different. So I suppose must me somewhere in my script...
def bazel_location = '/usr/local/bin/bazel'
def tf_location = '/home/poborak/SW/tensorflow-master'
def cpuType = 'armeabi-v7a'
def nativeDir = 'src/main/jniLibs/' + cpuType
project.buildDir = 'gradleBuild'
getProject().setBuildDir('gradleBuild')
buildscript {
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "bazinac.aplikacenahouby"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java', tf_location+'/tensorflow/contrib/android/java']
resources.srcDirs = ['src/main/java']
aidl.srcDirs = ['src/main/java']
renderscript.srcDirs = ['src/main/java']
res.srcDirs = ['src/main/res']
assets.srcDirs = ['src/main/assets']
jniLibs.srcDirs = ['src/main/jniLibs']
jni.srcDirs = []
}
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
testCompile 'junit:junit:4.12'
compile 'org.apache.commons:commons-io:1.3.2'
}
task buildNative(type:Exec) {
workingDir tf_location
commandLine bazel_location, 'build', '-c', 'opt', \
'tensorflow/examples/android:tensorflow_native_libs', \
'--crosstool_top=//external:android/crosstool', \
'--cpu=' + cpuType, \
'--host_crosstool_top=#bazel_tools//tools/cpp:toolchain'
}
task copyNativeLibs(type: Copy) {
from(tf_location+'bazel-bin/tensorflow/examples/android') { include '**/*.so' }
into nativeDir
duplicatesStrategy = 'include'
}
copyNativeLibs.dependsOn buildNative
assemble.dependsOn copyNativeLibs
Finally I have found workaround. It is to downgrade Gradle to 2.14.xx and Android Plugin Version 2.1.3. Then I have appended assembleDebug.dependsOn copyNativeLibs and it works now. Still I would be interested in better solution of course. (AssembleDebug property is not recognized in newer APV.

How to use new gradle experimental in Android Studio

I made a very hello world with Android Studio NDK. As instructed from http://tools.android.com/tech-docs/new-build-system/gradle-experimental, I copied exactly the same (left only some newer build tool version), but the error always appears:
Error:(49, 1) A problem occurred evaluating project ':app'.
Could not find method testCompile() for arguments [junit:junit:4.12] on project ':app'.
Could you tell me what's problem with my HelloWorld?
Here's my app build.gradle
apply plugin: "com.android.model.application"
model {
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig.with {
applicationId = "com.android.services.testjni"
minSdkVersion.apiLevel = 15
targetSdkVersion.apiLevel = 23
versionCode = 1
versionName = "1.0"
buildConfigFields.with {
create() {
type = "int"
name = "VALUE"
value = "1"
}
}
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file("proguard-rules.pro"))
}
}
android.productFlavors {
create("flavor1") {
applicationId = "com.app"
}
}
// Configures source set directory.
android.sources {
main {
java {
source {
srcDir "src"
}
}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
and build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle-experimental:0.2.1"
// 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
}
and gradle-wrapper.properties
#Fri Nov 27 17:00:16 ICT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip
AFAIK, android plugin doesn't have a testCompile configuration, which is one from gradle's java plugin, but has an androidTestCompile. So, you have to rename it in your dependencies, as:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}

Resources