小编Bul*_*ulu的帖子

RxJavaPlugins错误未找到类"com.google.devtools.build.android.desugar.runtime.ThrowableExtension"

升级Android Studio 3.0 Beta 1后出现以下错误.当我降级时,错误消失了.

Studio Build:Android Studio 3.0 Beta 1 Gradle插件版本:'com.android.tools.build:grad:3.0.0-beta1'Gradle版本:.0.0-beta1 Java版本:8 OS:MacOSX

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/devtools/build/android/desugar/runtime/ThrowableExtension;
at io.reactivex.plugins.RxJavaPlugins.onError(RxJavaPlugins.java:364)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:113)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6121)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)
Caused by: java.lang.ClassNotFoundException: 
Didn't find class "com.google.devtools.build.android.desugar.runtime.ThrowableExtension" on path: DexPathList[[zip file "/data/app/sark.savvy.Debug-1/base.apk",
 zip file "/data/app/sark.savvy.Debug-1/split_lib_dependencies_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_0_apk.apk",
  zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_1_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_2_apk.apk",
   zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_3_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_4_apk.apk", 
   zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_5_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_6_apk.apk",
    zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_7_apk.apk", zip file "/data/app/sark.savvy.Debug-1/split_lib_slice_8_apk.apk", …
Run Code Online (Sandbox Code Playgroud)

android android-gradle-plugin rx-java2 android-studio-3.0

28
推荐指数
2
解决办法
4178
查看次数

java.io.IOException:com.android.jack.api.v01.CompilationException:编译失败

下面是我在使用API​​ Level 24迁移Java 8时遇到的错误看起来它是来自lombok预处理器.任何帮助赞赏错误:/MyApp.native.android/AndroidApp/src/main/java/com/cba/MyApp/android/view/fragment/ProfileDetails/tabs/Profile.java:21:导入lombok无法解决

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':AndroidApp:compileMyAppDebugJavaWithJack'.
> java.io.IOException: com.android.jack.api.v01.CompilationException: Failed to compile
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':AndroidApp:compileMyAppDebugJavaWithJack'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.ParallelTaskPlanExecutor.process(ParallelTaskPlanExecutor.java:47)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at …
Run Code Online (Sandbox Code Playgroud)

android android-ndk android-sdk-tools build.gradle android-gradle-plugin

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

仅向 Kotlin DSL 中的“免费”产品风格添加实现依赖

我正在将基于 Groovy 的脚本迁移到 Kotlin。除了不确定如何为特定风味添加依赖项之外,我已经能够完成大部分工作。到目前为止,这是 Kotlin DSL 中的样子,但不确定为什么 freeImplementation("bar:2.2.8")

 productFlavors {
    create("free") {
         ...
         ...
    }
    create("paid") {
        ...
        ...
    }
}

dependencies {

    implementation("foo:1.2.0")

    // This is not working when migrated to Kotlin DSL
    freeImplementation("bar:2.2.8")

    //Below was the code in Groovy which was working fine earlier 
    //freeImplementation "bar:2.2.8"

}
Run Code Online (Sandbox Code Playgroud)

build.gradle android-gradle-plugin gradle-kotlin-dsl

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

如何从您的Android应用读取短信代码

我们正在寻求在应用程序中构建功能,以读取作为SMS的一部分发送并显示在textView上的安全代码。另外,我并不是要构建广播接收器,它可能是一种意图服务,它将仅在特定屏幕上开始运行,并在用户导航到另一个屏幕时终止该服务。

如果任何人都可以遮蔽一些灯光并提供一些示例代码,那将是很好的。

android android-intentservice

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

滚动视图中的ConstraintLayout

我正在寻求构建一个UI,以使其在横向显示滚动,并将按钮保持在屏幕的最底部并固定在页脚,但是在横向视图期间滚动之间应该有一定的距离。

任何帮助是极大的赞赏。

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.constraint.Guideline
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/guideline40PercentVertical"
    android:orientation="vertical"
    app:layout_constraintGuide_percent="0.35" />


<TextView
    android:id="@+id/tvPageHeader"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginTop="30dp"
    android:text="Your detail"
    android:textAlignment="center"
    android:textSize="25sp"
    app:layout_constraintHorizontal_bias="0.0"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<TextView
    android:id="@+id/tvLabelName"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:text="name"
    android:textAlignment="viewEnd"
    app:layout_constraintRight_toLeftOf="@+id/guideline40PercentVertical"
    android:layout_marginRight="10dp"
    android:layout_marginTop="62dp"
    app:layout_constraintTop_toBottomOf="@+id/tvPageHeader" />

<TextView
    android:id="@+id/tvName"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    tools:text="Mr. Ian Citizen"
    android:layout_marginLeft="10dp"
    app:layout_constraintLeft_toLeftOf="@+id/guideline40PercentVertical"
    app:layout_constraintBaseline_toBaselineOf="@+id/tvLabelName" />


<TextView
    android:id="@+id/tvLabelMobile"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="mobile"
    android:layout_marginRight="2dp"
    app:layout_constraintRight_toRightOf="@+id/tvLabelName"
    android:layout_marginTop="10dp"
    app:layout_constraintTop_toBottomOf="@+id/tvLabelName" />

<TextView
    android:id="@+id/tvMobile"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    tools:text="189232323"
    android:layout_marginLeft="0dp"
    app:layout_constraintLeft_toLeftOf="@+id/tvName"
    app:layout_constraintBaseline_toBaselineOf="@+id/tvLabelMobile" />



<TextView
    android:id="@+id/tvLabelEmail"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="email"
    android:layout_marginRight="2dp"
    app:layout_constraintRight_toRightOf="@+id/tvLabelMobile"
    android:layout_marginTop="10dp"
    app:layout_constraintTop_toBottomOf="@+id/tvLabelMobile" /> …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-constraintlayout constraint-layout-chains

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

org.gradle.api.plugins.UnknownPluginException - 'org.gradle.kotlin.kotlin-dsl

在我们的内部 CI 服务器中运行构建时,我收到以下错误。

org.gradle.api.plugins.UnknownPluginException:在以下任何来源中均未找到插件 [id:'org.gradle.kotlin.kotlin-dsl',版本:'0.18.1']:

  • Gradle 核心插件(插件不在“org.gradle”命名空间中)
  • 插件存储库(无法解析插件工件“org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:0.18.1”)在以下存储库中搜索:Gradle中央插件存储库

app/buildSrc/build.gradle.kts 下面是 build.gradle.kts 中的代码

plugins {
    `kotlin-dsl`
}
Run Code Online (Sandbox Code Playgroud)

即使我尝试包含上面或下面的存储库,插件也没有任何区别。

plugins {
    `kotlin-dsl`
}
repositories {
      maven("https://ci.mycompany.com/jcenter")
}
Run Code Online (Sandbox Code Playgroud)

android android-build gradle-kotlin-dsl

3
推荐指数
1
解决办法
2万
查看次数

Airbnb EpoxyModel 在 Android 的功能模块/库项目中不起作用

使用 Android 应用程序的内部功能模块时,EpoxyModels 未编译。

@EpoxyModelClass(layout = R.layout.layout_foo) //an annotation argument must be a compile-time constant here
abstract class  FooModel : EpoxyModelWithHolder<FooModel.FooHolder>() 
{
            ...
            ...

    class FooHolder : BaseEpoxyHolder() 
     {
       val textViewTitle: TextView by bind((R.id.textViewTitle))
       //bind is the method borrowed from [here](https://github.com/airbnb/epoxy/blob/963ef0fd850bd379da7b0be6a2ada25d01ae0ee7/kotlinsample/src/main/java/com/airbnb/epoxy/kotlinsample/helpers/KotlinEpoxyHolder.kt#L20)
     }
}
Run Code Online (Sandbox Code Playgroud)

上面的代码抱怨 layout = R.layout.layout_foo 行的“注释参数必须是编译时常量”。

再次基于文档看起来,butterknife 需要用于库项目(功能模块在某种程度上是一种库项目),它将基于生成 R2 类

下面是用 Butterknife 修改后的代码,我也认为这有点矫枉过正。不确定,为什么我不能只执行 findviewbyId。

ModelClass(layout = R2.layout.layout_foo)
abstract class  FooModel : EpoxyModelWithHolder<FooModel.FooHolder>() {

    @EpoxyAttribute
    lateinit var fooDto: Foo

    override fun bind(holder: FooHolder) {
        holder.textViewTitle.text = fooDto.title …
Run Code Online (Sandbox Code Playgroud)

android airbnb-js-styleguide epoxy epoxy-modelview

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

java.util.ConcurrentModificationException - Android

我有时会从以下代码中得到以下异常 人们建议,如果我将 for 循环设置为迭代器,它将解决该问题。但我不明白如果我没有删除 for 循环内的任何元素而是调用 pendingActions.clear(); 之后。如果有人遇到过这种情况,请告诉我。另外,你认为我是否向

private List<Action> pendingActions = Collections.synchronizedList(new ArrayList<>()); 
Run Code Online (Sandbox Code Playgroud)

会解决问题吗?

 private List<Action> pendingActions = new ArrayList<>();

private void runPendingNavigationActions() {
        if (!pendingActions.isEmpty()) {
            for (Action r : pendingActions) {
                r.run();
            }
            pendingActions.clear();
        }
    } 
Run Code Online (Sandbox Code Playgroud)

例外:

at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4156)
    at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4250)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1839)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7229)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    Caused by: java.util.ConcurrentModificationException
    at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
    at com.app.android.view.fragment.MainFragment.runPendingNavigationActions(MainFragment.java:1355)
Run Code Online (Sandbox Code Playgroud)

java android

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