I implemented an Android application using support.v7.app.AppcompatActivity. This application doesn't compile: when I hold my mouse cursor above the super key it shows the following error:
Cannot access android.support.v4.app.BaseFragmentActivityHoneycomb
I've a same problem.
And my resolution is:
Replace project dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
}
with
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-annotations:24.0.0'
}
It works for me,good luck.
It seems a compile issue. Try to check File -> project structure ->project -> set Gradle version and Android plugn version,then rebuild the project.
I found out the hidden issue by the operation.
Related
Currently, my project uses the Cast Companion library from sources. Here are my dependencies in my build.gradle file:
dependencies {
compile files('../../external/commonlibs/json/json-io-2.6.0.jar')
compile fileTree(dir: '../../external/commonlibs/annotations', include: '*.jar')
compile fileTree(include: '*.jar', dir: 'src/main/libs')
compile project(':common')
compile project(':common_ui')
compile project(':android-google-play-services_lib-v22')
compile project(':android-CastCompanionLibrary-v22')
compile project(':adara-middleware')
compile project(':android-support')
compile project(':android-mediarouter')
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
testCompile fileTree(dir: '../../external/testlibs', include: '*.jar')
androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2'
androidTestCompile 'com.android.support.test:rules:0.3'
}
I want to remove the line "compile project(':android-CastCompanionLibrary-v22')" and replace it with:
compile 'com.google.android.libraries.cast.companionlibrary:ccl:2.9.1'
When I do this, I get the following error:
Error:A problem occurred configuring root project 'Fling'.
> Could not resolve all dependencies for configuration ':_myCatapulTVeDebugApkCopy'.
> Could not find com.google.android.libraries.cast.companionlibrary:ccl:2.9.1.
Required by:
:Fling:unspecified
I am following the instructions from this link: https://github.com/googlecast/CastCompanionLibrary-android
When I add TabLayout inside my xml file it shows this error.
I also have these dependencies.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:support-v4:24.0.0'
}
See Code here
Add this dependency in gradle
compile 'com.android.support:design:23.1.0'
You can try to build it or change preview Android version in here Preview Android Version
I have imported two libraries in my Android Studio project through gradle. One is support library v7 which is a necessary component to handle action bar in my app for different platforms. Another is the one I intent to use for UI components called MaterialDesign.
Problem is that both libraries have defined an attribute in their values.xml called rippleColor and gradle identifies the conflict.
How can I tell gradle to exclude one definition and accept the other?
Manifest Merging in android developers hub seem to do that over the entire xml file whereas my problem is only one specific attribute in that file.
Is there any way that I can get around this problem?
P.S. my gradle dependencies are as follows:
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'org.xwalk:xwalk_core_library:15.44.384.13'
compile 'com.github.navasmdc:MaterialDesign:1.5#aar'
Write below code in your grade file. It might help:
dependencies {
compile 'com.android.support:support-v4:22.2.1'
compile 'com.google.code.gson:gson:2.2.2'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:design:22.2.1'
compile fileTree(dir: 'libs', include: '*.jar')
compile fileTree(include: ['*.jar'], dir: 'libs')
}
I am new to Roboelectric testing.
I am trying to follow this post to test fragments. I am using following as dependency
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile "org.robolectric:robolectric:3.0"
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.code.gson:gson:2.3'
compile 'com.android.support:support-v4:22.1.0'
compile 'com.google.android.gms:play-services:7.5.0'
}
But this import is giving me compilation issues, and I am not able to resolve the symbol SupportFragmentTestUtil to start with. Kindly guide me what I am missing??
org.robolectric.shadows.support.v4.SupportFragmentTestUtil
You need to add the dependency for v4 shadows support. Add this in your dependency file.
testCompile "org.robolectric:shadows-support-v4:3.0"
Earlier this week Android Studio started randomly deleting dependencies from my build.gradle file whenever I create a new file.
Is there a particular order that's expected?
My dependencies section looks like this:
dependencies {
compile project(':ParallaxScroll')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:4.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:support-v13:19.+'
compile 'com.android.support:appcompat-v7:19.+'
compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.4.1'
compile 'com.github.gabrielemariotti.cards:library:1.5.0'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.crashlytics.android:crashlytics:1.+'
}
When I create a new activity in the project it ends up looking like this (this happens every time):
dependencies {
compile project(':ParallaxScroll')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'com.squareup.picasso', name: 'picasso', version: '2.2.0'
compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.4.1'
compile 'com.google.android.gms:play-services:4.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.android.support:support-v13:19.+'
compile 'com.android.support:appcompat-v7:19.+'
}
It took a little while to figure out what was happening.
Which of the two compile formats I'm using is correct? Is this potentially causing issues? It wasn't an issue until this week.
I can of course restore my dependencies but this doesn't explain why AS is deleting things all the time.
I'm also concerned about both support libraries being included. As far as I know I'm using only v4 stuff. Is using both bad practice?
This is a bug that will be fixed in 0.5.9. You can track it here:
https://code.google.com/p/android/issues/detail?id=60749
In the meantime, as a workaround, just create new activities by hand, or save off the contents of the build file before creating them through the wizard.