App getting crashed in version 5.0 - android

The problem I am facing is that my android application works well on devices 4.4.2 and below, but crashes on devices having Lollipop(5.0) and its corresponding higher versions.I know that its somehow related to the build tools in my gradle file,but still not able to figure out the problem.Could someone please help me out with this.
This is my gradle file,
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.vs.vertosys"
minSdkVersion 14
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter() {}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:multidex:1.0.1'
// compile 'com.android.support:appcompat-v4:23.1.1'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-location:+'
compile 'com.pushwoosh:pushwoosh:+'
}

Related

How to solve "gradle failed resolve"?

Can't compile it and can't see in my library.
Error
gradle failed resolve `com.theartofdev.edmodo:android-image-cropper:+” Compilation fails.
build.gradle code
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.backuppc.breathanalyzer"
minSdkVersion 23
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
The dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.theartofdev.edmodo:android-image-cropper:+'
}
Please replace the
compile 'com.theartofdev.edmodo:android-image-cropper:+'
with the latest version
compile 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
Please make sure the dependency is of latest version. You can get the latest version here:
https://bintray.com/package/files/arthurhub/maven/Android-Image-Cropper?order=asc&sort=name&basePath=com%2Ftheartofdev%2Fedmodo%2Fandroid-image-cropper&tab=files
Hope this helps..

Gradle DSL method not found:'android()'

Android studio shows possible causes:
The project may be using a version of Gradle that does not contain the method.The build file may be missing a Gradle plugin.
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 17
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.android.application"
manifestPlaceholders = [manifestApplicationId: "${com.android.application}",
onesignal_app_id:"3z281386-18df-4ae8-95fb-da47db595f27",
onesignal_google_project_number:"570040958475"]
minSdkVersion 22
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-ads:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.google.android.gms:play-services-analytics:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0' }
You need to add
apply plugin: 'com.android.application'
As the first line of the build.gradle

My application is not working (not launching) with Kitkat or lower versions

i complied it with sdk 23 and tried to compile it with sdk 16 but errors pops up.. i cant build it with sdk 16.
i also tried changing target sdk and minimum sdk.
application works well with Lollipop and marshmallow.
but lower versions like kitkat gingerbread not opening. always force quitting.
my Build.gradle(app) File:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.braveheartcreations.wifiexplorer"
minSdkVersion 16
targetSdkVersion 17
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
lintOptions {
disable 'MissingTranslation'
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services:9.8.00'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'net.vrallev.android:cat:1.0.2'
provided 'org.projectlombok:lombok:1.16.6'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:support-v13:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.android.support:cardview-v7:23.2.0'
compile 'me.dm7.barcodescanner:zxing:1.9'
compile 'com.karumi:dexter:2.3.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.getbase:floatingactionbutton:1.9.0'
compile files('libs/ftp4j-1.7.2.jar')
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.1'
}
}
repositories {
mavenCentral()
}
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
You can't install this application into Android 4.0.4 and lower versions devices because the minSdkVersion is 16.For the kitkat device, you must paste the log here.
By the way,when you use compatibility with JavaVersion.VERSION_1_8, you must enable the jack.
defaultConfig {
...
jackOptions {
enabled true
}
}

Android cannot import RecyclerView & CardView

I'm not able to import RecyclerView & CardView although it seems very trivial. This is the relevant part from gradle.build script:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "23.0.0"
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
java {
srcDir 'src/main/java'
}
resources {
srcDir 'src/../lib'
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.1'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.google.android.gms:play-services:7.8.+'
}
The sync & build tasks executes normally so it seems that the dependencies actually downloaded. And when in some activity I try to import android.support.v7.widget.RecyclerView; it's not recognising the package.
Maybe it's SDK API versions issues? Note I need min 11 and target max 22.
Add recent recyclerview which is in your sdk.
right click on app --> Open Module Settings --> Dependencies
then on right side click on plus button. Add library dependency and search recyclerview and then add it.
Hope it will work.
You need to change the buildToolsVersion. See the below code.
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.0.2"
defaultConfig {
minSdkVersion 11
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:palette-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:support-v4:21.0.3'
compile files('libs/picasso-2.2.2.jar')
compile project(':Cropper')
compile project(':library')
compile project(':quickScroll')
}

Android Studio gives me Execution failed for task ':library:proguardRelease' error after updating to Android Studio 1.0.1

I updated my Android Studio to 1.0.1. I followed this tutorial http://tools.android.com/tech-docs/new-build-system/migrating-to-1-0-0 and changed from runProguard to minifyEnabled true. I also changed it in my library project. When I tried to compile it gave me Error:Execution failed for task ':> java.io.FileNotFoundException: ProjectName\library\proguard-rules.txt (The system cannot find the file specified). I researched for that and I found a solution. I added blank proguard-rules.txt file into that folder. After trying to compile, it gave me even more errors. The main error now was that it cannot find symbol class PageIndicator, which is my library's class. I don't even know what can I do for that.
My project's build.gradle:
apply plugin: 'android'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.miesto.meniu"
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library')
compile files('libs/volley.jar')
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-v4:21.0.0'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.0#aar'
compile('com.google.api-client:google-api-client-xml:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
compile 'com.google.http-client:google-http-client-gson:1.17.0-rc'
compile('com.google.api-client:google-api-client-android:1.17.0-rc') {
exclude group: 'com.google.android.google-play-services'
}
compile 'com.google.apis:google-api-services-drive:v2-rev105-1.17.0-rc'
compile files('libs/YouTubeAndroidPlayerApi.jar')
}
My library's build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "20.0.0"
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:21.0.0'
}
What am I doing wrong?
I solved this problem when I deleted my library and added it again.

Categories

Resources