Recently after upgrading android studio 4.1 my app started to stuck in "running gradle task assembledebug" so i checked the web for possible solution
Tried flutter clean and gradle commands changed gradle files but nothing worked finally deleted gradle and reinstalled android studio again but now i can't get android sdk 28 to be installed (it doesnt appear in sdk list) so i changed sdk to 29 but whenever i try to run my app it gives the fallowing errors
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.5.3.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.5.3.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
> Connect to localhost:3128 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
> Could not resolve com.android.tools.build:gradle:3.5.3.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.5.3/gradle-3.5.3.pom'.
> Connect to localhost:3128 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
> Could not resolve com.google.gms:google-services:4.3.4.
Required by:
project :
> Could not resolve com.google.gms:google-services:4.3.4.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.4/google-services-4.3.4.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/google/gms/google-services/4.3.4/google-services-4.3.4.pom'.
> Connect to localhost:3128 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
> Could not resolve com.google.gms:google-services:4.3.4.
> Could not get resource 'https://jcenter.bintray.com/com/google/gms/google-services/4.3.4/google-services-4.3.4.pom'.
> Could not GET 'https://jcenter.bintray.com/com/google/gms/google-services/4.3.4/google-services-4.3.4.pom'.
> Connect to localhost:3128 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
* 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
BU�LD FAILED in 1m 24s
Exception: Gradle task assembleDebug failed with exit code 1
My current project level build gradle file is like this.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.4'
}
}
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
}
App lvl build gradle file is like this:
def localProperties = new Properties()
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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 29
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.farukdurusoy.sayi_avi"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
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.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
Also disabled my firewalls. Any suggestions?
Related
I am trying to run my flutter app in the android studio 3.5 version and I am not able to do. I upgraded flutter and reinstalled android studio. I invalidated cache and restart and nothing is solving my problem. I tried using visual studio code but I get the same error. Below you can see the errors I am getting.
Does anyone know how to solve this? my android studio was working fine before but not sure if this happened after the update or something.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
Required by:
project :
> Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50.
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.3.50/kotlin-gradle-plugin-1.3.50.pom'.
> Remote host closed connection during handshake
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.41.
Required by:
project : > com.android.tools.build:gradle:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.lint:lint-gradle-api:26.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:gradle-api:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > androidx.databinding:databinding-compiler-common:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools:sdk-common:26.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools:common:26.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools.build:manifest-merger:26.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools.analytics-library:tracker:26.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools:sdklib:26.5.0 > com.android.tools:repository:26.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0 > com.android.tools:sdk-common:26.5.0 > com.android.tools.analytics-library:shared:26.5.0
> Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.41.
> Could not get resource 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.41/kotlin-stdlib-jdk8-1.3.41.pom'.
> Could not GET 'https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.41/kotlin-stdlib-jdk8-1.3.41.pom'.
> Remote host closed connection during handshake
> Could not resolve org.ow2.asm:asm:6.0.
Required by:
project : > com.android.tools.build:gradle:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04
> Could not resolve org.ow2.asm:asm:6.0.
> Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm/6.0/asm-6.0.pom'.
> Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm/6.0/asm-6.0.pom'.
> Remote host closed connection during handshake
> Could not resolve org.ow2.asm:asm-analysis:6.0.
Required by:
project : > com.android.tools.build:gradle:3.5.0
> Could not resolve org.ow2.asm:asm-analysis:6.0.
> Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm-analysis/6.0/asm-analysis-6.0.pom'.
> Remote host closed connection during handshake
> Could not resolve org.ow2.asm:asm-commons:6.0.
Required by:
project : > com.android.tools.build:gradle:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04
> Could not resolve org.ow2.asm:asm-commons:6.0.
> Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-commons/6.0/asm-commons-6.0.pom'.
> Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm-commons/6.0/asm-commons-6.0.pom'.
> Remote host closed connection during handshake
> Could not resolve org.ow2.asm:asm-util:6.0.
Required by:
project : > com.android.tools.build:gradle:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04
> Could not resolve org.ow2.asm:asm-util:6.0.
> Could not get resource 'https://jcenter.bintray.com/org/ow2/asm/asm-util/6.0/asm-util-6.0.pom'.
> Could not GET 'https://jcenter.bintray.com/org/ow2/asm/asm-util/6.0/asm-util-6.0.pom'.
> Remote host closed connection during handshake
> Could not resolve net.sf.jopt-simple:jopt-simple:4.9.
Required by:
project : > com.android.tools.build:gradle:3.5.0
project : > com.android.tools.build:gradle:3.5.0 > com.android.tools.build:builder:3.5.0
> Could not resolve net.sf.jopt-simple:jopt-simple:4.9.
> Could not get resource 'https://jcenter.bintray.com/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom'.
> Could not GET 'https://jcenter.bintray.com/net/sf/jopt-simple/jopt-simple/4.9/jopt-simple-4.9.pom'.
> Remote host closed connection during handshake
my build.gradle is
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
}
and app/build.gradle is
def localProperties = new Properties()
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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.erod.xform_master"
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
First at all check your flutter doctor in cmd and see that everything is working fine, and after that, when you make a new flutter project in android studio don't use kotlin or java as lenguague by default, Don't mark any on them, just left them empty
I want to build APK Flutter with android studio. I also use firestore in this application. When i try to build, i get this error
Exception in thread "ForkJoinPool.commonPool-worker-0" java.lang.IllegalStateException: AAPT Process manager cannot be shut down while daemons are in use
at com.android.builder.internal.aapt.v2.Aapt2DaemonManager.shutdown(Aapt2DaemonManager.kt:96)
at com.android.build.gradle.internal.res.namespaced.RegisteredAaptService.shutdown(Aapt2DaemonManagerService.kt:61)
at com.android.build.gradle.internal.workeractions.WorkerActionServiceRegistry$shutdownAllRegisteredServices$1$1.run(WorkerActionServiceRegistry.kt:96)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource compilation failed
Output: D:\Compile\ttpproject\android\app\src\main\res\mipmap-hdpi\book.png: error: failed to read PNG signature: file does not start with PNG signature.
Command: C:\Users\hunterpama\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\d657dbace268bb20677284d59b1f0de8\aapt2-3.2.1-4818971-windows\aapt2.exe compile --legacy \
-o \
D:\Compile\ttpproject\build\app\intermediates\res\merged\release \
D:\Compile\ttpproject\android\app\src\main\res\mipmap-hdpi\book.png
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #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.
* Get more help at https://help.gradle.org
BUILD FAILED in 1m 28s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 89.1s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
*******************************************************************************************
Gradle task assembleRelease failed with exit code 1
here my file for: android\app\build.gradle
and on application id i not left empty. I just do not want to display it here
def localProperties = new Properties()
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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
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 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId ""
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// 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.debug
// }
// }
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
i just wonder is there any confusion in sync with flutter and android. During debug, it works fine. NO error popup
i have know the reason of it. it because of image size. but i do not have proper image size for build.
Migrate your project to AndroidX.
If you have AndroidStudio 3.2 or greater you can refactor
It looks like you might have tried to build your Flutter APK using Android Studio. You need to go to your Flutter console, navigate to your project, and type this is the command line: flutter build apk --split-per-abi
I have some problems while running flutter in android studio
This is my error
Launching lib\main.dart on Moto C Plus in debug mode...
Initializing gradle...
Resolving dependencies...
Finished with error: Please review your Gradle project setup in the android/ folder.
* Error running Gradle:
Exit code 1 from: D:\FlutterPrograms\app\android\gradlew.bat app:properties:
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to E:\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
Where:
Build file 'D:\FlutterPrograms\app\android\app\build.gradle' line: 25
What went wrong:
A problem occurred evaluating project ':app'.
Could not resolve all artifacts for configuration 'classpath'.
Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
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 1s
This is my buid.gradle file
buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.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
}
This is my gradle error
def localProperties = new Properties()
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 = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 27
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.shanmukh.app"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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.debug
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
There were lots of similar issues raised the past days, that could be solved by adding the google() repository in first position in the repositories block of the build scripts.
See detailed explanation in the following answers:
couldn't locate lint-gradle-api-26.1.2.jar for flutter project
Could not find play-services-basement.aar
https://stackoverflow.com/a/52982816/6899896
Could not find com.android.tools.build:aapt2:3.2.0
The root cause , related to missing libraries in Jcenter, is explained in detail here : https://stackoverflow.com/a/50885939/6899896
Open the root flutter folder in your computer, and open the gradle folder in that root folder (For example C:\flutter\package\flutter_tool\gradle) and add 'google()' to the buildscript. It fixed the issue for me.
Flutter root folder:
Add 'google()' to the buildscript:
I found a solution!
Go to your flutter folder. After you need to find flutter.gradle. On my PC:
C:\src\flutter\packages\flutter_tools\gradle
Open flutter.gradle with note or notepad and change
buildscript from this:
repositories {
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
to this:
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
I am working on one library project in android. I want to upload my library to the JCenter. I have created bintray account etc & followed all steps which are mentioned here.
I did below changes in my application module & library module.
Application Module build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.app.testapp"
minSdkVersion 8
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile project(':testlib')
}
Library Module build.gradle
apply plugin: 'com.android.library'
ext {
bintrayRepo = 'maven'
bintrayName = 'test-sdk'
publishedGroupId = 'in.test.sdk'
libraryName = 'testlib'
artifact = 'test-sdk'
libraryDescription = 'A wrapper for Facebook Native Like Button (LikeView) on Android'
siteUrl = 'https://github.com/xyz/testsdk'
gitUrl = 'https://github.com/xyz/testsdk.git'
libraryVersion = '1.0.0'
developerId = 'xyz'
developerName = 'xyz'
developerEmail = 'xyz#xyz.xyz'
licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}
version = "1.0.0"
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// proguardFiles 'proguard-project.txt'
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:22.2.0'
compile files('libs/gson-2.3.1.jar')
compile files('libs/android-query-full.0.26.8.jar')
compile files('libs/httpmime-4.1.1.jar')
compile files('libs/jackson-annotations-2.5.0.jar')
compile files('libs/javax.annotation.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/okhttp-2.3.0.jar')
compile files('libs/okio-1.3.0.jar')
compile files('libs/retrofit-1.9.0.jar')
}
Latest Project root build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
classpath 'com.github.dcendents:android-maven-plugin:1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id "com.jfrog.bintray" version "1.2"
}
allprojects {
repositories {
jcenter()
}
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'java'
}
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
groupId 'in.freeb.sdk'
artifactId 'freeb-sdk'
version '1.0'
}
}
}
bintray {
user = 'ajay-spice'
key = '31317855920db8f7bc27f97730a8e9f99b6f707e'
publications = ['MyPublication']
pkg {
repo = 'maven'
name = 'freeb-sdk'
userOrg = 'ajay-spice'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/ajay-spice/freebsdk.git'
labels = ['gear', 'gore', 'gorilla']
publicDownloadNumbers = true
attributes= ['a': ['ay1', 'ay2'], 'b': ['bee'], c: 'cee'] //Optional package-level attributes
version {
name = '1.0-Final'
desc = 'FreeB 1.0 final'
vcsTag = '1.0.0'
attributes = ['freeb-sdk': 'in.freeb.sdk']
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}
I am getting this error:
:bintrayUpload FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bintrayUpload'.
> Could not create version '1.1-Final FreeB': HTTP/1.1 400 Bad Request [message:Unable to create version 1.1-Final FreeB at 'ajay-spice/maven/freeb-sdk']
* 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: 22.448 secs
Log file in Debug mode
:app:install
:app:bintrayUpload FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bintrayUpload'.
> Could not create version '1.1-Final FreeB': HTTP/1.1 400 Bad Request [message:Unable to create version 1.1-Final FreeB at 'ajay-spice/maven/freeb-sdk']
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:bintrayUpload'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:130)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: org.gradle.api.GradleException: Could not create version '1.1-Final FreeB': HTTP/1.1 400 Bad Request [message:Unable to create version 1.1-Final FreeB at 'ajay-spice/mav
en/freeb-sdk']
at com.jfrog.bintray.gradle.BintrayUploadTask$_bintrayUpload_closure6_closure27_closure31.doCall(BintrayUploadTask.groovy:280)
at groovyx.net.http.HTTPBuilder$1.handleResponse(HTTPBuilder.java:503)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1070)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:1044)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:515)
at groovyx.net.http.HTTPBuilder.doRequest(HTTPBuilder.java:434)
at groovyx.net.http.HTTPBuilder.request(HTTPBuilder.java:383)
at groovyx.net.http.HTTPBuilder$request$0.call(Unknown Source)
at com.jfrog.bintray.gradle.BintrayUploadTask$_bintrayUpload_closure6.doCall(BintrayUploadTask.groovy:272)
at com.jfrog.bintray.gradle.BintrayUploadTask$_bintrayUpload_closure6.doCall(BintrayUploadTask.groovy)
at com.jfrog.bintray.gradle.BintrayUploadTask.bintrayUpload(BintrayUploadTask.groovy:383)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 47 more
BUILD FAILED
Total time: 45.144 secs
The error indicates that you have tried using '1.0-Final FreeB' as the version name which is an invalid version name:
message:Unable to create version 1.1-Final FreeB at 'ajay-spice/maven/freeb-sdk'
A version name must start with a letter or a number and can only contain letters, numbers and the following symbols: .-_:##$~
The build.gradle sources in your question shows a valid version name - '1.1-Final', however this is different from the build.gradle in your Github project which is using the invalid version name.
I am using Android Studio to develop an Android application and I am using Gradle to handle the build. When I try to compileDebug the project, I errors that some libraries aren't found. These libraries are included in the build.gradle file and should be linked by gradle. Since the libraries aren't found at compilation, I think these files aren't linked correctly by gradle.
Can anyone have a look at the configuration file and look for anything wrong with it? Thanks:
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
mavenCentral()
}
dependencies {
//classpath 'com.android.tools.build:gradle:0.6.+'
classpath 'com.android.tools.build:gradle:1.1.0'
}
}
apply plugin: 'android'
repositories {
maven {
url 'https://github.com/Goddchen/mvn-repo/raw/master/'
}
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:13.0.0'
compile 'com.google.android.gms:play-services:3.1.36'
compile 'com.google.code.gson:gson:2.2.4'
//compile 'com.codeslap:persistence:0.9.24'
compile 'org.apache.commons:commons-io:1.3.2'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.8.4'
//compile 'com.facebook.android:facebook:3.5.2'
compile 'com.facebook.android:facebook:3.17.1'
compile files('libs/rollbar-android-0.0.6.jar')
compile files('libs/libGoogleAnalyticsV2.jar')
//compile files('libs/commons-codec-1.7-SNAPSHOT-android.jar')
compile files('libs/tinylinetry_and.jar')
}
android {
compileSdkVersion 18
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 14
targetSdkVersion 18
}
signingConfigs {
release {
storeFile file("../keystore.jks")
storePassword "******"
keyAlias "Android Release Key"
keyPassword "******"
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
}
release {
signingConfig signingConfigs.release
}
}
}
The error I get is from this kind:
:app:compileDebugJava
.../Application.java:55: error: package com.rollbar.android does not exist
import com.rollbar.android.Rollbar;
....
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
So all external libraries that are loaded and should be included by gradle aren't found.