Getting issue with Android development - android

Please see following attached screen shot. I will try to add android-v4 jar file but getting issue in android stdio (in Android stdio, Adding by import project feature)
When importing jar file den got following error.
build.gradle (Module::App) file is here
android {
compileSdkVersion 13
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.jigsaw.startup"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
// compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.loopj.android:android-async-http:1.4.6'
compile 'com.android.support:support-v4:21.0.3'alert
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
Let me know if anybody need any extra information.

This statement in your build script:
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
is explicitly excluding anything from com.android.support.v4 from being linked into your project, so that's why the import com.android.support.v4.Fragment statement isn't working. Remove that and the import should be fine.

I changed android API and worked on Andoid 4.2. then issue resolved.
Thanks to all

Related

Running project on Android Studio fails because of missing app module

When I press on run in Android studio an Edit configuration windows pops up and says "Error: Module not specified".
I have added sources to the application libs folder by manually making a folder structure android/hardware/automotive/vehicle/V2_0 and copied the files in there.
Build completes without errors.
I haven't edited the MainActivity -class so it is all pre-generated code.
I believe this error has something to do with incorrect syntax when including but it seems to be hard to get it working :)
this is my settings.gradle file:
include ':app'
project(':app').projectDir = new File('libs/android/hardware/automotive/vehicle/V2_0')
and this is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.s26150.testingopencar"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile project(":android.hardware.automotive.vehicle.V2_0")
testCompile 'junit:junit:4.12'
}
What could be the issue here?
thanks in advance.

Error with adding dependencies to my build.gradle in android studio (Conflict with dependency)

I am new to android studio and am trying to add Google sheets api v4. On their website it says to add some dependencies to my build.gradle file.
Here is what my gradle currently looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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.google.android.gms:play-services-location:11.0.4'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
The error occurs when I try to add the following lines
compile('com.google.api-client:google-api-client-android:1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-sheets:v4-rev483-1.22.0') {
exclude group: 'org.apache.httpcomponents'
}
When I try to sync my Gradle I instead get this error:
Error:Conflict with dependency 'com.google.code.findbugs:jsr305' in project ':app'. Resolved versions for app (1.3.9) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
Any help fixing this would be appreciated as I am pretty new to android studio.
In your build.gradle (in app folder) add the following inside android{} body
android {
....
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
Related answer: https://stackoverflow.com/a/37357786/8405762

compile appcompat v7:26.+ error when adding play services for fusion location provider

I have an issue and have looked at possible duplicate questions and answers and I think this one is not answered by the others so asking it here.
I updated my play services to make use of the fused location provider and now the appcompat in my gradle is showing an error.
So I created a new project and checked the build.gradle on the new project and have exactly the same appcompat but my project is showing an error.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "au.com.itmobilesupport.sqltwo"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services:11.0.1'
}
Its this line that is showing the error:
compile 'com.android.support:appcompat-v7:26.+'
But in a new project its fine. Why am I getting the error?
UPDATE:
If I remove these two lines then the error goes away:
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.google.android.gms:play-services:11.0.1'
But I need them so still have the error.
Add these lines to your build.gradle file to get libraries that you don't have based on Google site.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
Caution: Using dynamic dependencies (for example, palette-v7:23.0.+) can cause unexpected version updates and regression incompatibilities. We recommend that you explicitly specify a library version (for example, palette-v7:25.4.0).
Finally solved the issue with the help of ZeroOne's answer to a similar question.
What led me to look at ZeroOnes answer was Google giving me the reason but not as an error. My issue was that the following line is too encompassing and a lot of extra dependencies were added that would have made the app unnecessarily larger.
compile 'com.google.android.gms:play-services:11.0.1'
I simply needed to be more specific and the error disappeared.
Here is the final gradle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "au.com.itmobilesupport.sqltwo"
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-maps:11.0.1'
compile 'com.google.android.gms:play-services-location:11.0.1'
}
And this is the specifc line I change the above to:
compile 'com.google.android.gms:play-services-location:11.0.1'
Hope it helps someone who comes across the same issue.
Being more specific using compile 'com.google.android.gms:play-services-location:11.0.1' rather than compile 'com.google.android.gms:play-services:11.0.1' saved my project as well, tks a lot guys.

While rebuilding my project warning about httpcomponents is shown

While rebuilding my project i encountered this warning
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
here is my gradle.build in which i have tried adding the stated solutions in given link but the problem still persists.So what should i do?
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
// tried this but no help
// useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 18
targetSdkVersion 25
versionCode 1
versionName "1.0.0"
resConfigs "en_US", "hi_IN"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
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'
})
//tried this but no help
// compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'com.android.support:gridlayout-v7:25.1.1'
compile 'com.android.support:cardview-v7:25.1.1'
testCompile 'junit:junit:4.12'
Question reffered for solution
EDIT: the issue is about something else
Add the dependency like this:
android {
useLibrary 'org.apache.http.legacy'
}
From here: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client
Problem solved after removing this dependency completely from my project
compile 'io.kickflip:sdk:1.3.1'
and also from my libs dir.

failed to find 'com.firebase:firebase-ui:0.2.0' in android studio

I want to use firebase UI in my android app, but it constantly give build error while adding dependency in `android studio
i tried the tutorial at https://github.com/firebase/FirebaseUI-Android#using-the-library-in-your-android-app and
https://www.firebase.com/blog/2015-08-27-firebaseui-makes-mobile-easy.html
But both gives me same error
here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "re.book.bookify"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
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:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.github.shell-software:viewmover:1.1.0'
compile 'com.github.shell-software:uitools:1.1.0'
compile 'com.firebase:firebase-client-android:2.3.1+'
compile 'com.firebase:firebase-ui:0.2.0'
}
Please post your build.gradle First
Add the following lines to the dependencies object at the bottom:
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebaseui:firebase-ui:0.2.0'
Check This Instructions
https://github.com/firebase/FirebaseUI-Android#using-the-library-in-your-android-app
Thanks Frank van Puffelen, that was the exact problem.
The gradle link given at https://www.firebase.com/blog/2015-08-27-firebaseui-makes-mobile-easy.html is not correct,
The 0.2 version of FirebaseUI was published in the com.firebaseui group. So the gradle link for it is compile 'com.firebaseui:firebase-ui:0.2.0'

Categories

Resources