Cannot Resolve Symbol Application in android studio - android

When we write a code color of word 'Application', it changes to red. Can anyone help me out with this?
Here is my build.gradle app
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.nabeel.ask"
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(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
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.0-alpha7'
compile 'com.android.support:design:26.+'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile 'com.google.android.gms:play-services:8.3.0'
}

Try to clean and rebuild your project
Build>Clean Project/Rebuild project

Related

cant import some libraries in android studio

I am trying to import some libraries like Picasso, etc. but Android Studio shows up with this message.
here is the build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.mypc.urumcafe"
minSdkVersion 17
targetSdkVersion 25
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:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.volley:volley:1.0.0'
compile 'com.amitshekhar.android:android-networking:1.0.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
I just want to import 'com.amitshekhar.android:android-networking:1.0.1'but as you can see in the uploaded image there is "failed to resolve" error.
so how can I fix this? the same story is for Picasso lib.
Thank you.
Update your build tools version to 27.0.3 and corresponding dependencies to sdk version 27.
here is the updated build.gradle and it is working perfectly.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.example.mypc.urumcafe"
minSdkVersion 17
targetSdkVersion 27
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:27.1.1'
compile 'com.android.support.constraint:constraint-layout:2.+'
compile 'com.android.volley:volley:1.0.0'
compile 'com.amitshekhar.android:android-networking:1.0.1'
compile 'com.android.support:design:27.1.1'
testCompile 'junit:junit:4.12'
}
The newest version of the library is 1.0.2.
Use this and try again:
com.amitshekhar.android:android-networking:1.0.2
you might be lacking the Maven Central (or the jitpack.io for v1.0.2) repository:
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}

Multiple dex files define-volley

error when build apk....
[enter image description here][1]
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/android/volley/VolleyError;
my gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.morten.gpibwal.desakayuambon"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
}
}
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.volley:volley:1.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.github.bumptech.glide:volley-integration:1.4.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
The solution is
delete "compile 'com.github.bumptech.glide:volley-integration:1.4.0'
com.android.dex.DexException: Multiple dex files define
Lcom/android/volley/VolleyError;
You should delete
compile 'com.github.bumptech.glide:volley-integration:1.4.0'
Then Clean-Rebuild-Run.
add multiDexEnabled true in gradle file also use same version for compile dependencies check below code
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.morten.gpibwal.desakayuambon"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
}
}
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.volley:volley:1.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.github.bumptech.glide:volley-integration:1.4.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:design:25.0.0'
testCompile 'junit:junit:4.12'
}
remove unnecessary empty
dexOptions {
}

i can not run my app because SDK 26 > device SDK 24?

When I want to run app on my phone I face this proplem: min sdk 26 > device sdk24
How can I fix that?
build gradle :
android {
compileSdkVersion 26
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.asus.order"
minSdkVersion 26
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'
}
}
productFlavors {
}
}
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'
})
//Add Library
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'info.hoang8f:fbutton:1.0.5'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Just set the minSdkVersion to 24 or lower

PHONE_VERIFICATION_PROVIDER in Firebase AuthUI not woiking

Phone verification in my android application is not working. when i am adding AuthUI.PHONE_VERIFICATION_PROVIDER, the editor showing that cannot resolve symbol. Other verification method like Google or email are working fine.
Here is the screen-shot for this:
Here is Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com.example.nishant.kitchenbook"
minSdkVersion 21
targetSdkVersion 23
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:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.firebaseui:firebase-ui-auth:1.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Upgrade your firebaseui version to the latest. Change compile 'com.firebaseui:firebase-ui-auth:1.0.1' to compile 'com.firebaseui:firebase-ui-auth:2.1.1'

java.util.zip.ZipException: duplicate entry: android/support/v4/view/KeyEventCompatEclair.class

Error:Execution failed for task ':jobFlexwithInvoice:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException:duplicateentry:android/support/v4/view/MotionEventCompatEclair.class
i have this problem and my gradle file is,
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.studity.socet_store"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//compile files('libs/android-support-v4.jar')
compile 'com.android.support:design:22.2.0'
compile files('libs/Parse-1.3.0.jar')
compile files('libs/signpost-commonshttp4-1.2.1.2.jar')
compile files('libs/signpost-core-1.2.1.2.jar')
compile files('libs/signpost-jetty6-1.2.1.2.jar')
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:support-v4:22.2.0'
}
what should i do!?
Try this..
compile ('com.android.support:support-v4:22.2.0') {
exclude module: 'support-v4'
}
Instead of
compile 'com.android.support:support-v4:22.2.0'
or exclude module: to other where problem create

Categories

Resources