小编Sta*_*y T的帖子

如何找到Android Studio的嵌入式JDK版本?

我试图找出我的Android Studio使用的JDK版本.我很困惑,因为我的/ Program Files/Java目录中有很多版本

在此输入图像描述 不幸的是,项目结构没有任何JDK的版本号. 在此输入图像描述

android android-studio

14
推荐指数
2
解决办法
6246
查看次数

如何检查是否不显示弹出通知。浓咖啡

我有弹出通知。我的第一个测试检查该通知是否显示并且是否成功通过。我使用下一个方法进行此测试:

fun viewInNotificationPopupIsDisplayed(viewMatcher: Matcher<View>) {
    onView(viewMatcher)
        .inRoot(RootMatchers.isPlatformPopup())
        .check(ViewAssertions.matches(isDisplayed()))
}
Run Code Online (Sandbox Code Playgroud)

我对第二个测试用例有问题,我必须检查我的弹出通知是否已经消失(意味着它不再显示)。所以我尝试使用下一个方法:

    fun viewInNotificationPopupIsNotDisplayed(viewMatcher: Matcher<View>) {
        Espresso.onView(viewMatcher)
            .inRoot(RootMatchers.isPlatformPopup())
            .check(matches(not(isDisplayed())))
          //.check(ViewAssertions.doesNotExist())  // doesn't work as well
    }
Run Code Online (Sandbox Code Playgroud)

我得到下一个异常:

android.support.test.espresso.NoMatchingRootException: 
Matcher 'with decor view of type PopupWindow$PopupViewContainer' 
did not match any of the following roots: 
[Root{application-window-token=android.view.ViewRootImpl$W@bb8371e,
 window-token=android.view.ViewRootImpl$W@bb8371e, has-window-focus=true, 
Run Code Online (Sandbox Code Playgroud)

请问有人可以帮忙吗?

android kotlin android-espresso

5
推荐指数
1
解决办法
1570
查看次数

SharedPreferences :它是一个类还是一个接口?

我很困惑,请帮助我。

Android 开发人员文档SharedPreferences是一个Interface,我们也可以在grepCode上看到SharedPreferences 是一个Interface

developers.android也说SharedPreferences是一个类。

他们写。

“SharedPreferences提供了一个通用框架......”

那么,SharedPreferences 是一个还是一个接口

android sharedpreferences

4
推荐指数
1
解决办法
1772
查看次数

如何将KVM从本地机器传递到docker容器?

我正在尝试通过下一个命令在 Docker 容器中启动 Android 模拟器(又名 AVD)

docker run -it img_emulator:v1 
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

emulator: CPU Acceleration: DISABLED
emulator: CPU Acceleration status: /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded
emulator: ERROR: x86_64 emulation currently requires hardware acceleration!
Please ensure KVM is properly installed and usable.
CPU acceleration status: /dev/kvm is not found: VT disabled in BIOS or KVM kernel module not loaded
Run Code Online (Sandbox Code Playgroud)

事实上,我的笔记本电脑上有 Linux 18.04 虚拟化。我在 Bios 中启用了它并通过下一个命令检查它:

kvm-ok
Run Code Online (Sandbox Code Playgroud)

系统报告:

INFO: /dev/kvm exists
KVM acceleration can …
Run Code Online (Sandbox Code Playgroud)

continuous-integration android docker

1
推荐指数
1
解决办法
6732
查看次数

RxJava。Observable.OnSubscribe 无法解析为类型

我正在尝试用 RxJava 编写我的第一个代码,但我想我遇到了一些库导入错误。

package second.pack;
import io.reactivex.Observable;
public class Main {
    public static void main(String[] args) {
        Observable <String> observable = Observable.create(
// the line below marked as it has an error in Eclipse
/* 7 line */    new Observable.OnSubscribe<String>(){
                    @Override
                    public void call (Subscriber <String> sub){
                      sub.onNext("New Datas");
                      sub.onComplete(); 
                }
            }
    );
}
Run Code Online (Sandbox Code Playgroud)

}

错误

Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
    Observable.OnSubscribe cannot be resolved to a type
    at second.pack.Main.main(Main.java:7)
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

请问有人能帮我解决这个错误吗?非常感谢!

java rx-java

0
推荐指数
1
解决办法
1099
查看次数

错误 java.lang.NoSuchMethodError:没有静态方法

我正在尝试从下面的 git 链接运行代码

https://github.com/Mikhail57/RetrofitTutorial

但我收到一个错误

java.lang.NoSuchMethodError:没有静态方法 getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; 在类 Landroid/support/v4/content/res/ResourcesCompat 中;或其超类(“android.support.v4.content.res.ResourcesCompat”的声明出现在 /data/app/com.stanlytango.android.secondfromgitretrofit-aDuaUJp0_br091ehbTa3bQ==/split_lib_dependency_apk.apk 中)

我的应用程序 build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.stanlytango.android.secondfromgitretrofit"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    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'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.retrofit2:converter-gson:2.3.0'
    compile 'com.google.code.gson:gson:2.8.2'
    implementation 'com.android.support:recyclerview-v7:27.0.2'
}
Run Code Online (Sandbox Code Playgroud)

活动_主布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android" …
Run Code Online (Sandbox Code Playgroud)

java android compiler-errors

-4
推荐指数
1
解决办法
8048
查看次数