enter image description here
Hi there
I face a problem with android studio,
it could not find the " fragment" in library,
i try to fix it from project structure and dependency then + then add "com.android.support:support-v4" but nothing changed.
your turn experts :).
go into the build.gradle (module app) file and you'll have something like this:
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
}
Add this line to it: compile 'com.android.support:support-v4:24.0.0' and than a bar in the top will appear, click rebuilt.
That's how you import libraries.
Related
I'm very new to the android development. I imported my friend's project in my android studio and I'm having this trouble right now that I'm unable to sort out on my own. Please help me fix it.
You have to add the design support library in your build.gradle :
implementation 'com.android.support:design:25.3.1'
Package android.support.design.widget.FloatingActionButton and android.support.design.widget.Snackbar lies under design-support library. You have to add design-support library into your project.
Add below dependencies into your app modules build.gradle file and Sync .
dependencies {
............
................
compile 'com.android.support:design:25.3.1'
}
Hope this will help
FloatingActionButton and snackbar are components of design LIB
Add this in your app gradle file
compile 'com.android.support:design:23.1.1'
Using Android Studio 2.0 over El Capitan like the next screenshot said:
I found a bug that I can't report:
After add a Fragment to my project, AS screw up my module build.gradle file. I mean, before add the fragment they file looks like this screenshot:
but after add the Fragment AS screw it in this way:
The way to reproduce it is like I'm showing in next screenshot:
I can fix it manually, but its so annoying doing it every single time that I add a Fragment. Is there anyway to fix it?
I'm on Mac OX with El Capitan.
It is a still open bug, you can monitor it's state here
The bug is due to the comments in the dependencies section, a temporal fix could be to remove them from there. I placed the comments there for a reason too :)
Delete all comments in your gradle file
put your constraint-layout on the bottom, it will not scramble again (i don't know why, but it works)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// support lib
compile "com.android.support:appcompat-v7:$supportlib_version"
// kotlin
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
// ...
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
just reformat your project level gradle . It will work fine. These compile statement got dis-formatted. Just hit Enter before every "compile"
it should be like:
compile 'com.android.support:support-v13:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
So, I followed this tutorial to create a ListView with images using Volley but I am having this issue with the com.android.volley.xxxx import statements in LruBitmapCache.java, AppController.java, CustomListAdapter.java, and MainActivity.java. It shows as Unused import statements and its extension are in red saying Cannot resolve symbol xxxx. Volley.jar is already aded to app -> libs section.
Would appreciate any help.
I'd double check to make sure your build.gradle includes:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
...
}
And also make sure you've ran a sync.
Add
compile 'com.mcxiaoke.volley:library:1.0.6#aar'
to your Gradle dependencies...
Add this in your build.gradle of your app
https://developer.android.com/training/volley/
implementation 'com.android.volley:volley:1.1.1'
im getting error in my android project The import android.support.v7.app cannot be resolved and even i import library from properties .
which i downloaded from https://github.com/koush/android-support-v7-appcompat.
and added in project from properties but still getting error
You need to add the appropriate dependency to your module gradle.build file as follows:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.2'
}
Make sure to synchronize your build.gradle file (Right click on file --> Synchronize 'build.gradle') and Clean your project (Build --> Clean Project) after the change.
I have imported successfully from Maven Repository the com.actionbarsherlock:actionbarsherlock:4.4.0 and com.android.support:support-v4:20.0.0. But when i try to import
import com.actionbarsherlock.app.SherlockActivity;
it doesnt import and also if i try to run the application i get a similar error to:
Multiple dex files define Android studio error when trying to import Google Maps into Google Maps project
I dont get the point here why the action bar sherlock library is not imported correctly even that the maven repository is added to dependency correctly .
The problem is solved. I found out the solution by changing build.gradle of my app and adding the #aar part in the compile section of actionbarsherlock
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:20.0.0'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
}
This solved the problem and i found out the solution reading this:
https://code.google.com/p/maven-android-plugin/wiki/ApkLib