我试图找出为什么我的Android工作室没有正确识别AppCompat v7库.下面的import语句显示为灰色,并表示没有support.v7.app的包.以下是我的活动文件:
import android.support.v7.app.AppCompatActivity;
public class XApplicationActivity extends AppCompatActivity
Run Code Online (Sandbox Code Playgroud)
我的build.grade:
compile "com.android.support:appcompat-v7:22.0.0"
compile "com.android.support:support-annotations:$ANDROID_SUPPORT_VERSION"
compile "com.android.support:support-v4:$ANDROID_SUPPORT_VERSION"
Run Code Online (Sandbox Code Playgroud)
我的项目设置:
minSdkVersion = 14
targetSdkVersion = 21
compileSdkVersion = 21
buildToolsVersion = "22.0.1"
Run Code Online (Sandbox Code Playgroud)
所以我真的很困惑为什么这仍然给我带来问题.我已经尝试过的事情:
有谁知道任何修复?这花了我很多时间,这真的令人沮丧.
android android-appcompat android-library android-support-library
所以我最近将我的robolectric 3.0升级与我们的主线合并,后者为我们的应用添加了多索支持.不幸的是,这有导致我们的测试失败/不运行的不幸副作用 - 他们只是在第一次尝试安装MultiDex失败后停止,使用此堆栈跟踪:
java.lang.RuntimeException: java.lang.RuntimeException: Multi dex installation failed (/Users/me/Data/Projects/my-android/myapp/. (Is a directory)).
at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:257)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:194)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
at …Run Code Online (Sandbox Code Playgroud) android gradle robolectric robolectric-gradle-plugin android-multidex
我是开发Android的新手,并且在不同平台上开发的概念在每个平台上都有不同的支持功能,这真的让我很头疼.
例如,如果我进入xml文件并进行设置
android:elevation="10dp"
Run Code Online (Sandbox Code Playgroud)
并且它给我的消息"属性提升仅用于API级别21及更高级别(当前最小值为14),并且说它将简单地忽略该属性.这是说它即使我使用它也会完全忽略它一个棒棒糖设备,或者如果我不在Lollipop设备上它只会忽略它?
android android-studio material-design android-5.0-lollipop android-elevation
所以每个在线资源都告诉我这样的事情:
cmp %eax, %ebx
jg < something >
Run Code Online (Sandbox Code Playgroud)
如果 eax 大于 ebx,将跳转到 < something >。但我有另一段似乎与此矛盾的代码:
cmp $0x2, %eax
jg < something>
Run Code Online (Sandbox Code Playgroud)
当 eax 的值为 3 时,它会跳转到 < something >。
我是否遗漏了什么,或者如果 b > a 而不是 a>b,cmp a, b - jg 是否执行?这是否也适用于其他跳转语句?
我不太确定log(n ^ 2)是否与log(n)的复杂程度相同.我已经花了一段时间,因为我已经采取了预分解,而且我对日志的了解已经大大减少了 - 如果有人能帮助我解释这个问题,我真的很感激.
我的应用程序的主要主题继承自Theme.AppCompat,并且我创建了一个选择器,当您按下并将焦点按在Lollipop上时,可以进行Ripple效果.
但是,当我回到4.0设备时,当我聚焦列表视图项时,它默认返回到丑陋的蓝色.我到处寻找定义这种颜色的特性希望在没有任何运气的情况下覆盖它 - 任何想法我怎么能这样做?