我有以下课程
import com.android.annotations.NonNullByDefault;
@NonNullByDefault
public final class Log {
...
}
Run Code Online (Sandbox Code Playgroud)
这是我的build.gradle文件(省略了一些部分)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '24.0.1'
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 2
versionName "0.2"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-annotations:25.0.0'
compile 'com.android.support:design:25.0.0'
}
Run Code Online (Sandbox Code Playgroud)
在Android Studio中,我的课程没有警告
但是,当我尝试构建和运行我的应用程序时,我从gradle中得到了此错误
Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:assembleDebug]
Warning:[options] bootstrap class path not set in conjunction with -source 1.7
/home/puter/git-repos/TaskManager3/app/src/main/java/com/treemetrics/taskmanager3/util/Log.java
Error:(3, 31) error: package com.android.annotations does not exist …Run Code Online (Sandbox Code Playgroud) android gradle android-studio android-gradle-plugin react-native
我刚刚开始在Android中进行测试,这看起来非常基本,但经过大量的谷歌搜索,我仍然无法找到答案.
在我的Android应用程序中,显示的第一个活动是登录屏幕,然后是主屏幕,其中包含导航到其他活动的选项.为了测试我想要的活动,我现在必须首先完成这两项活动.
如何设置Espresso测试(使用ActvityTestRule/JUnit4),以便它立即启动我想要测试的活动?
编辑
更具体地说,我的问题是,在Espresso测试的所有教程中,所有测试都从应用程序的主要活动开始,其ActivityTestRule看起来像这样
@Rule
public final ActivityTestRule<MainActivity> mRule = new ActivityTestRule<MainActivity>(MainActivity.class);
Run Code Online (Sandbox Code Playgroud)
我希望测试从指定的活动开始,目前我通过不断重复这样的测试代码来导航
onView(withId(R.id.go_to_other_activity_button)).perform(click())
Run Code Online (Sandbox Code Playgroud) 我一直试图找出如何申请@IntRange(from = 1)我的 Kotlin 财产。经过几次失败的尝试,我终于在 Java 中创建了我想要的类,并将其转换为 Android Studio 中的 Kotlin。这是我的 Java 类:
import android.support.annotation.IntRange;
public class SimpleThing {
private int val;
@IntRange(from = 1)
public int getVal() {
return val;
}
public void setVal(@IntRange(from = 1) int val) {
this.val = val;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我从 Android Studio 得到的自动转换:
import android.support.annotation.IntRange
class SimpleThing {
@get:IntRange(from = 1)
var `val`: Int = 0
}
Run Code Online (Sandbox Code Playgroud)
在@IntRange似乎得到应用吸气剂,但不二传手。是否可以将此注释也应用于 setter,以便出现适当的 lint 警告。目前我刚刚覆盖了 set 方法来抛出一个 IllegalArgumentException 像这样:
@get:IntRange(from = 1)
var rowSize: …Run Code Online (Sandbox Code Playgroud) android kotlin android-lint android-annotations kotlin-interop
我写了以下注释:
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.METHOD})
public @interface Warning {
}
Run Code Online (Sandbox Code Playgroud)
这是为了注释那些在不小心调用时可能导致问题的方法.我在我的项目中添加了一个注释处理器,但这只在javac命令的日志输出中提供了警告.我希望此警告与其他lint警告一起出现在Android Studio中,并且调用带有此批注的方法.这就是我尝试编写自定义lint规则的原因.我有lint规则的基本框架:
import com.android.tools.lint.detector.api.Category;
import com.android.tools.lint.detector.api.Detector;
import com.android.tools.lint.detector.api.Implementation;
import com.android.tools.lint.detector.api.Issue;
import com.android.tools.lint.detector.api.Scope;
import com.android.tools.lint.detector.api.Severity;
public class CaimitoDetector extends Detector implements Detector.JavaScanner {
public static final Issue ISSUE = Issue.create(
"WarningAnnotation",
"This method has been annotated with @Warning",
"This method has special conditions surrounding it's use, be careful when using it and refer to its documentation.",
Category.USABILITY, 7, Severity.WARNING,
new Implementation(CaimitoDetector.class, Scope.JAVA_FILE_SCOPE));
@Override
public void …Run Code Online (Sandbox Code Playgroud) 我的Android项目的应用模块中的build.gradle中包含以下代码
implementation('com.google.firebase:firebase-core:16.0.1', {
exclude group: 'com.android.support'
})
implementation('com.google.firebase:firebase-database:16.0.1', {
exclude group: 'com.android.support'
})
implementation('com.google.firebase:firebase-auth:16.0.1', {
exclude group: 'com.android.support'
})
implementation('com.google.firebase:firebase-crash:16.0.1', {
exclude group: 'com.android.support'
})
Run Code Online (Sandbox Code Playgroud)
firebase库都包含我正在使用的android支持库的冲突版本,因此我需要将其排除以防止生成警告
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 26.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version …Run Code Online (Sandbox Code Playgroud) android gradle build.gradle android-gradle-plugin android-gradle-3.1.0
我的Crashlytics数据未显示在Firebase Crashlytics视图中.它确实显示"无崩溃统计数据"为75%,因此它似乎记录了一些数据.我还看到崩溃现在立即出现在Fabric和旧的Firebase崩溃报告界面中,以及在DebugView中作为常规事件出现,但在Crashlytics页面的"问题"部分中没有任何内容.我认为也许我的Fabric项目没有链接到我的Firebase项目,但是当我尝试使用此链接手动执行时https://www.fabric.io/firebase_migration/apps它告诉我项目已经链接,特别是说Project already contains a linked app with that bundle ID and platform.每次我在Android studio中打开我的应用程序时,我立即运行命令,adb shell setprop debug.firebase.analytics.app ie.moses.keepitlocal以便我的事件将出现在DebugView中,也许这可能会影响它,但我对此表示怀疑.
这是我的项目build.gradle文件:
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
这是我的特定应用程序模块的build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
def supportLibraryVersion = '27.1.1'
android { …Run Code Online (Sandbox Code Playgroud) android firebase crashlytics firebase-crash-reporting google-fabric
我正在编写一个使用Facebook SDK(特别是登录名和朋友列表)的Android应用程序。我将前4位测试人员添加到https://developers.facebook.com/apps/ {APP-ID} / roles / roles /中,没有任何问题(这些用户没有被要求确认他们只是想成为测试人员,立即添加为测试人员),此后我添加的任何测试人员都标记为“待审核”,但用户从未收到邀请他们成为测试人员的通知(除非用户在正常的Facebook通知中确实收到了通知)。我相信这个问题已经被问过了,但是到目前为止,还没有答案,Facebook也没有提供讨论这个问题的论坛,这一问题证明了这一点https://www.facebook.com/help/community/question/?id=3608173820208
android ×7
android-lint ×2
gradle ×2
build.gradle ×1
crashlytics ×1
facebook ×1
firebase ×1
kotlin ×1
react-native ×1