I want to know why my Android studio Cannot resolve AppCompactActivity symbol, when I try to add the AppCompat v7 library This import statement
import android.support.v7.app.AppCompatActivity;
shows up with gray color and says unused import statement
and v7 with red color and says Cannot resolve symbol'v7'
import android.support.v7.app.AppCompatActivity;
public class speech extends AppCompatActivity
build.grade:
compile "com.android.support:support-v4:${androidSupportLibraryVersion}"
compile 'net.sourceforge.htmlcleaner:htmlcleaner:2.18'
compile 'de.cketti.library.changelog:ckchangelog:1.2.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.splitwise:tokenautocomplete:2.0.7'
compile 'de.cketti.safecontentresolver:safe-content-resolver-v14:0.9.0'
compile 'com.squareup.moshi:moshi:1.2.0'
compile "com.jakewharton.timber:timber:${timberVersion}"
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
testCompile "org.robolectric:robolectric:${robolectricVersion}"
testCompile "junit:junit:${junitVersion}"
testCompile "org.mockito:mockito-core:${mockitoVersion}"
testCompile 'org.jsoup:jsoup:1.10.2'
how can I solve this?
Add AppCompat Library in Gradel file.
compile "com.android.support:support-v4:${androidSupportLibraryVersion}"
compile "com.android.support:appcompat-v7:${androidSupportLibraryVersion}"
compile "com.android.support:support-annotations:${androidSupportLibraryVersion}"
Sometimes clearing the android studio caches help.
In android studio I just cleared the caches and restarted with the following option--
File->Invalidate Caches/Restart
Related
When I initially used the code below in my build.gradle file, it helped me import the authentication.
compile 'com.google.firebase:firebase-auth:9.2.1'
After adding the below code to my build.gradle file
compile 'com.google.firebase:firebase-database:9.6.0'
Making me to have:
compile 'com.google.firebase:firebase-auth:9.2.1'
compile 'com.google.firebase:firebase-database:9.6.0'
together in my dependency, hence my authentication stopped working, displaying an error message in my MainActivity that I declared it.
"Cannot resolve symbol FirebaseUser" since FirebaseUser is what I named my import to be. Please help.
add same Dependencies version..
compile 'com.google.firebase:firebase-auth:9.6.0'
compile 'com.google.firebase:firebase-database:9.6.0'
After I updated my Support library from 23.1.1 to 23.4.0 I get this warning cannot access android.support.v4.app.baseFragmentActivityEclair on every call to super and every instance of AppCompatActivity
And if I updated my support library to 24.1.1 The warning changes to cannot access android.support.v4.app.baseFragmentActivityJB.
Can anyone tell me why this warning is shown and how can I remove this warning:
here is my dependencies before:
(no error in this)
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
here is my dependencies after cannot access android.support.v4.app.baseFragmentActivityEclairwarning:
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
here is my dependencies after cannot access android.support.v4.app.baseFragmentActivityJBwarning:
compile 'com.android.support:palette-v7:24.1.1'
compile 'com.android.support:gridlayout-v7:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
We ran into a similar problem when one of the packages in our project had dependencies on version 24.0 support libraries and another package was dependent on version 23.4.0. This seems to be a problem for the Android Studio (IntelliJ) IDE, not the compiler, because we were able to build and run the project without any problems. We resolved the warning by reverting the 24.0 dependency to 23.4.0. I suspect that going the other direction (advancing all of our package dependencies to 24.0) would also have eliminated the warning but we didn't experiment with that due to the number of packages in our project.
If you're looking to hack around this, many of the support libraries have an internal library called libs/internal_impl-$VERSION.jar that includes these types of version-specific implementations. To get your IDE to work, you can extract these JARs and manually include them in your IDE's build path.
For example, you can extract the classes referenced here, assuming version 24.2.1, using this command:
unzip support-fragment-24.2.1.aar libs/internal_impl-24.2.1.jar
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.
I am new to AWS. I created AWS sample app which works fine. But when I try to add the code to my new application, I am getting error in Application class on import statement.
import com.amazonaws.mobile.AWSMobileClient;
import com.amazonaws.mobile.push.PushManager;
import com.amazonaws.mobile.user.signin.SignInManager;
public class Application extends MultiDexApplication {
private final static String LOG_TAG = Application.class.getSimpleName();
#Override
public void onCreate() {
// My code //
.
.
.
Android studio gives error on "mobile" part of these import statements.
I don't know if any Jars needs to be added in the project.
Gradle code builds without the error.
Following is my gradle code -
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'app/libs')
compile 'com.android.support:design:23.2.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:support-v4:23.1.0'
compile('com.amazonaws:aws-android-sdk-s3:2.2.11')
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile('com.amazonaws:aws-android-sdk-cognito:2.2.11')
compile('com.amazonaws:aws-android-sdk-mobileanalytics:2.2.11')
compile('com.amazonaws:aws-android-sdk-sns:2.2.11')
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-plus:7.8.0'
compile 'com.android.support:multidex:1.0.0'
Let me know if I should add some more of my code here.
The classes you try to import do not exist in the AWS SDK. Check the sample to find out where they come from.
Please read the instructions in the READ_ME/index.html file of your sample download project. The same instructions exist on the Build page in AWS Mobile Hub. There you will find instructions to copy/paste the helper source code that was included in the download into your own project, including the com.amazonaws.mobilehub java package. This source is included in the project download and must be copied to your own product application.
https://forums.aws.amazon.com/forum.jspa?forumID=88
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.