I have downloaded me friends android project. When I open it with android studio it starts to sync gradle. However it gives to me invalid argument error.
My build.gradle file:
buildscript {
repositories {
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
maven { url 'http://audiobox.keytwo.net' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "kz.itsolutions.businformator"
minSdkVersion 19
targetSdkVersion 23
versionCode 20150105
versionName "1.95"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode = true
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'org.osmdroid:osmdroid-android:4.2'
compile 'org.slf4j:slf4j-simple:1.6.1'
compile 'com.parse.bolts:bolts-android:1.2.0'
compile files('libs/Parse-*.jar')
compile 'com.android.support:support-v4: 22.1.1'
}
I think the main problen is the compileSdkVersion, buildToolsVersion, midsdkVersion and targetSdkVersion. I have installed all avilable sdk versions and changed these numbers, stil does not work.
I think this project uses outdated gradle version which had different argument for something.
What needed to change to make project able to build?
Stack trace of my gradle is:
Gradle 'bus_informator' project refresh failed
Error:Error:Invalid argument
I have tried to find similar questions, but I haven't found.
I have run gradlew assemble --info and it gave me that kind of error:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.crashlytics.sdk.android:crashlytics:1.7.0.
Searched in the following locations:
http://dl.bintray.com/populov/maven/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
http://dl.bintray.com/populov/maven/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
https://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
https://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
https://maven.fabric.io/public/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
https://maven.fabric.io/public/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
http://audiobox.keytwo.net/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
http://audiobox.keytwo.net/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
Required by:
bus_informator:app:unspecified
I fixed this problem by changing this
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/*.jar')
to this
compile fileTree(dir: 'libs', include: ['*.jar'])
Related
So I have built an Android app where am using Signal R.
I have imported both signalr-client-sdk-android and signalr-client-sdk found at Github repo
The gradle for each file builds successfully but when I am trying to compile the code in whole i get the message below :
After a small research I did I found out that apparently the libs i downloaded from the repo are compiled by using jdk 1.7 while my Android studio setup is using 1.8.
Any ideas how can I resolve this?
Below you can find my Gradle files :
My apps Gradle :
buildscript {
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
repositories {
maven {
url 'https://maven.fabric.io/public'
}
maven {
url 'https://clojars.org/repo'
}
}
android {
compileSdkVersion 25
buildToolsVersion "23.0.2"
sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
defaultConfig {
applicationId "com.pushdr.application"
minSdkVersion 17
targetSdkVersion 17
ndk {
moduleName "ndkVidyoSample"
}
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
mavenCentral()
maven {
url 'https://github.com/FireZenk/maven-repo/raw/master/'
}
}
allprojects {
repositories {
mavenCentral()
}
}
buildTypes {
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
armv7a {
ndk {
abiFilter "armeabi-v7a"
}
}
fat ///This build contain multi architecture binary
}
}
dependencies {
//facebook SDK
//Used for Signal R + Chat
//Used for PIN entry
compile project(':pinentry')
//Menu Drawer
compile project(':materialTabs')
//Credit Card Payment Libraries
compile project(':creditcarddesign')
//Audio waves
compile project(':audiowaves')
compile project(':signalr-client-sdk')
compile project(':signalr-client-sdk-android')
compile('com.crashlytics.sdk.android:crashlytics:2.6.4#aar') {
transitive = true;
}
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.roger.gifloadinglibrary:gifloadinglibrary:1.0.0'
compile 'com.wdullaer:materialdatetimepicker:2.5.0'
compile 'com.synnapps:carouselview:0.0.9'
compile 'com.ragnarok.rxcamera:lib:0.0.4'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.17'
compile 'com.stripe:stripe-android:2.0.2'
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.github.2359media:EasyAndroidAnimations:0.8'
compile 'com.mikepenz:crossfader:1.3.7#aar'
compile 'com.mikepenz:crossfadedrawerlayout:0.3.4#aar'
compile 'com.mikepenz:itemanimators:0.2.4#aar'
compile 'com.mikepenz:google-material-typeface:2.2.0.1#aar'
compile 'com.mikepenz:fontawesome-typeface:4.4.0.1#aar'
compile 'com.mikepenz:octicons-typeface:3.0.0.1#aar'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
compile 'com.google.code.gson:gson:2.8.0'
}
signalr - client - sdk - android: gradle
apply plugin: 'com.android.library'
repositories {
maven {
url 'https://clojars.org/repo'
}
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':signalr-client-sdk')
}
signalr - client - sdk: gradle
apply plugin: 'java'
repositories {
maven {
url 'https://clojars.org/repo'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.3'
compile 'org.java-websocket:java-websocket:1.3.1'
}
You can use Java8. When you run javac, you must give it the arguments '-target 1.7 -source 1.7' so that it produces code that is compatible with Java7. You do this indirectly for your own source code by correctly configuring your gradle build scripts.
However, I don't think that is your problem. The android gradle tools will automatically run javac correctly on your source code. I expect the problem is with third-party libraries that you are including in your project.
You need to make sure that every library you use is compiled for Java7. Somewhere on your classpath you have a .class file that was compiled with '-target 1.8'.
Trying to compile my android app with google app engine module but the darn thing won't work. It WAS working before but for some reason after I cleared my Android Studio cache and restarted, it stopped compiling. Here is the error I get:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> java.io.IOException: Failed to delete /Users/Me/AndroidStudioProjects/MyCoolApp/app/build/intermediates/pre-dexed/debug/appengine-api-1.0-sdk-1.9.18_0179742441e08a2aeb8477eb85038e2130d180e7.jar
I checked the folder and the above file does not even exist - so why does it try to delete it?
I also tried putting in a dummy file with the above name hoping that might work but it did not.
Here are what my gradle files look like:
app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.me.mycoolapp"
minSdkVersion 13
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-gcm:8.4.0' //Needed for GCM
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':backend')
}
apply plugin: 'com.google.gms.google-services' // Needed for GCM
Project:
// 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:2.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3' // Needed for GCM
// 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
}
Very dumb but for some reason (I have no clue why) Android studio added this line to my file
compile project(':backend')
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-gcm:8.4.0' //Needed for GCM
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
//compile project(':backend') //DELETE THIS
}
Man, Android Studio + GAE module getting really annoying to make these days...
In your build.gradle script, set the dexOptions.javaMaxHeapSize configuration
android {
...
...
dexOptions {
javaMaxHeapSize "4g"
}
}
Referring question here.
Problem is that i am including something which is repeated.
Can somebody help me figure which one is causing problem?
And this error started arising when i added twitter sdk.
build.gradle
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.sony.login_signup"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.shamanland:facebook-like-button:0.1.8'
compile 'com.google.android.gms:play-services:+'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.github.curioustechizen.android-ago:library:1.3.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile('com.twitter.sdk.android:twitter:1.9.0#aar') {
transitive = true;
}
}
If you do:
gradle -q dependencies
It should output a tree of all gradle dependencies and their dependencies. If you trace the dependency tree you will find which ones are using support-v4 and their versions, to tell you where the problem is.
EDIT:
This should be run on a command line / terminal. Gradle is just another program...
https://docs.gradle.org/current/userguide/tutorial_gradle_command_line.html
To do this, make sure that "gradle" is in your environment PATH (this is different depending on if you're Windows or Mac, but if you search you will find it).
Then run the command from the folder where your "build.gradle" and "settings.gradle" files are located (your project "root" folder typically).
Error:(25, 13) Failed to resolve: com.google.code.gson:gson:2.3.1
Show in Project Structure dialog
build.gradle:app
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "com.app.main"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
}
}}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.google.android.gms:play-services-base:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile project(':Uni_Image_Lod_Lib') }
builde.gradle:Project
// 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.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}}
allprojects {
repositories {
jcenter()
}
}
step follows:
Android Studio Version 1.3.2
Restart computer
Invalidate caches/Restart
up dawn dependency.
but nothing to change. now what will be the solution for this.
After Some Changes
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.app.main"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
}
}}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile project(':Uni_Image_Lod_Lib') }
and get error rebuild
Unresolved dependencies detected while building project in offline mode. Please disable offline mode and try again.
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve com.google.code.gson:gson:2.3.1.
Required by:
APP:app:unspecified
No cached version of com.google.code.gson:gson:2.3.1 available for offline mode.
No cached version of com.google.code.gson:gson:2.3.1 available for offline mode.
then i have see in prefrences-> Build, Execution, deployment -> gradle.
project level setting is:
ticked use local gradle distribution
global gradle setting:
offline work is not ticked
compile 'com.google.code.gson:gson:2.3.1'
remove .1 and make it compile
'com.google.code.gson:gson:2.3'
as 2.3.1 is not stable and live yet, that's y its giving your error. also never use + while compiling as its not a best practice as per my knowledge.
You can simply do following:
buildscript {
repositories {
mavenCentral() //Add following
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
mavenCentral() // Add following
jcenter()
}
}
This is de build.gradle of app module:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 10
targetSdkVersion 22
versionCode 19
versionName "1.6.2"
}
buildTypes {
release {
minifyEnabled false
debuggable false;
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/assets/'] } }
}
repositories {
maven { url 'http://dl.bintray.com/madcyph3r/maven/' }
maven { url 'http://dl.bintray.com/amulyakhare/maven' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.google.android.gms:play-services:7.5.0"
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'net.glxn.qrgen:android:2.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'de.madcyph3r:materialDrawer:1.1.1#aar'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'com.android.support:support-v4:22.2.0'
compile 'com.google.zxing:core:3.2.0'
compile 'me.dm7.barcodescanner:zxing:1.7'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'org.apache.commons:commons-io:1.3.2'
compile files('libs/GraphView-4.0.1.jar')
compile files('libs/mpandroidchartlibrary-2-1-0.jar')
compile files('libs/bitcoinj-core-0.12.3-bundled.jar')
}
And this is build.gradle of project
// 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.0'
classpath 'com.google.gms:google-services:1.3.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
I'm trying use Google cloud Messaging , I have followed all steps in https://developers.google.com/cloud-messaging/android/client but when I synchronize gradle files with the project I get this:
Failed to complete gradle execution. Cause: [empty]
I tried implement this solution: Android Studio: failed to complete gradle execution, cause is empty and other similar solutions but result is same.
What could be the solution to this problem? Someone has happened this?
Thaanks in advance!!
I found the solution:
The problem lies not in GCM. The problem arises when I try to compile the app. I used the command;
gradlew assembleDebug --stacktrace
and I threw this error:
Unable to execute dex : method ID not in [0 , 0xFFFF ] : 65536.
I've solved with the steps described Google here:
Building Apps with Over 65K Methods