Android Studio cannot resolve support library name space - android

I installed Android Studio over existing SDK with the latest Android Support Library but with a blank project open it cannot resolve this: import android.support.v7.app.AppCompatActivity;
What should I do?

Check your gradle file. It must include (version may way):
compile 'com.android.support:appcompat-v7:23.3.0'

In your gradle.build include this dependency
compile 'com.android.support:appcompat-v7:23.3.0'

Check your build.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
**compile 'com.android.support:appcompat-v7:23.2.0'**
}
This may solve your problem.

Related

how can I use this library in android studio

I don't know how to add this library to my project.
https://github.com/alamkanak/Android-Week-View
thank you.
Edit : can anyone explain how to open the sample app as an android project?
https://github.com/alamkanak/Android-Week-View/tree/develop/sample
In your build.gradle(app:module) add this line in the dependencies block:
implementation 'com.github.alamkanak:android-week-view:1.2.6'
and follow instruction according to the link you posted.
On your file gradle insert into dependencies paste this compile 'com.github.alamkanak:android-week-view:1.2.6'
Example:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:26.0.2'
compile 'com.android.support:design:26.+'
compile 'com.github.alamkanak:android-week-view:1.2.6'
}
Then click sync now.
Add this line inside module build.gradle file
compile "com.github.alamkanak:android-week-view:1.2.6"
Now sync gradle file and library will be added into project now you can follow instructions on github about calendar customization and settings

Android Studio gradle update error

I am working on geofencing app in Android. If I set the
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-location:9.0.1'
}
it works fine.If I changed it to
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-location:11.0.2'
}
I get following error.
package com.google.android.gms.maps does not exist
package com.google.android.gms.maps.model does not exist
Why? I need to set it to 11.0.2 for integrating it with other app.
Sync Project With Gradle File may help. Just click the button next to AVD Manager or navigate through Tools->Android->Sync Project With Gradle File.
Try to sync your project with gradle file but if gradle sync failed then download the latest version of gradle and specify its path under build.gradle and try to sync again.
you got to install the missing google play services.
Go to settings and update your google play services and google repository to latest version which is 46 means you got to use this version 11.0.46

Android Eclipse : How to resolve third party library dependencies corresponding to gradle build

I am porting an android application project built with non-eclipse tool, with gradle in use, perhaps the tool was Android Studio. I have the .zip file of the project. So, far I have put all layout,values and drawables in place. I am stuck at the last step of dependencies.
The project depends on Github : BlueJamesBond library and many others. This is the build.gradle dependencies
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile "com.android.support:support-v4:+"
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'com.github.bluejamesbond:textjustify-android:2.1.6'
}
Now, the BlueJamesBond itself is using gradle and I have no idea how gradle works. I was expecting some jar of the library which I could have added in Build Path. Can anyone please suggest how to resolve the dependency in my project?

I am facing following rendering problems in Android Studio when I try to open my project. How can I resolve it?

I am facing following rendering problems in Android Studio when I try to open my project. How can I resolve it?
Seems like your libraries are pretty old
Please add this in gradle.build
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.+'
compile 'com.android.support:design:23.1.1'
}

Android Studio cannot resolve symbol 'TabLayout'

Cannot resolve symbol TabLayout ? How to clear this error? Please help me. I already imported import android.support.design.widget.TabLayout;
Had a similar problem, to fix this in Android Studio (AS) I went Build->Clean Project and AS sorted everything out. Make sure in your build.gradle file under dependencies that you have:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:your_api_version_number.0.0'
compile 'com.android.support:design:+'
}
I solved the issue Manually by adding the following two lines:
implementation 'com.android.support:support-v4:22.2.0'
implementation 'com.android.support:design:22.2.0'
under dependencies in \app\build.gradle worked for me.
Note: Your all the support libraries have to be the same version i.e. appcompat-v7 and support-v4 to same version e.g. 23.0.1; otherwise you can get this error
java.lang.NoClassDefFoundError: android.support.v7.internal.widget.TintManager`
after code build
Under Gradle Scripts,
Open build.gradle (Module: app)
Inside of dependencies add
compile 'com.android.support:design:25.3.1'
There may be a newer version of the library available, the android studio lint check may detect that.
The full dependencies area may look like this for reference. The above line is the only one I manually added.
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:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.3.1'
}
An above answer suggested adding
compile 'com.android.support:design:+'
Which is kind of dangerous because it always uses the latest library, you may have trouble isolating bugs with automatic library updates happening in the background.
Android Studio no longer uses "compile", they use "implementation".
Be sure to include the code below when you go to Build Gradle>dependencies{
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
For Android API Level 29+, add the following dependency in build.gradle (Module:app):
dependencies {
implementation 'com.google.android.material:material:1.0.0'
}
If there is a newer version available, Android Studio will prompt you to use the newest one.
I solve it by Open build.gradle (Module: app) and add
implementation 'com.android.support:design:+'

Categories

Resources