【问题标题】:How to implement androidx work runtime in android.mk?如何在 android.mk 中实现 androidx 工作运行时?
【发布时间】:2020-09-14 12:12:24
【问题描述】:

我正在尝试将一个库添加到我的 Android.mk 文件中,但我还没有成功。 build.gradle 文件中有该库的实现,如下所示;

implementation "androidx.work:work-runtime:2.4.0"

在 Android.mk 文件中我使用了类似的东西;

LOCAL_STATIC_ANDROID_LIBRARIES := \
    androidx.work_work-runtime

但是当我构建项目时它给出了一个错误。

error: MyApp (APPS android-arm) missing androidx.work_work-runtime (JAVA_LIBRARIES android-arm) 
You can set ALLOW_MISSING_DEPENDENCIES=true in your environment if this is intentional, but that may defer real problems until later in the build.
build/make/core/main.mk:846: error: exiting from previous errors.

所以如果有人可以在这里帮助我,我会很高兴。谢谢!!!

【问题讨论】:

    标签: android runtime androidx android-workmanager android.mk


    【解决方案1】:

    将以下定义添加到您的 makefile..

    LOCAL_STATIC_ANDROID_LIBRARIES := \
      androidx.core_core
    
    LOCAL_STATIC_JAVA_LIBRARIES := \
      androidx.lifecycle_lifecycle-runtime \
      androidx.lifecycle_lifecycle-service \
      androidx.room_room-runtime \
      androidx.sqlite_sqlite \
      androidx.sqlite_sqlite-framework \
      guava \
      workruntime
    
    LOCAL_AAPT_FLAGS := \
      --extra-packages androidx.work
    
    LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := workruntime:libs/work-runtime-2.4.0.aar
    include $(BUILD_MULTI_PREBUILT)
    

    【讨论】:

    • 感谢@oguz-gencer。我能够在 Android.mk 中包含 androidx.work。在运行时,我面临这个问题“java.lang.NoSuchMethodError:没有虚拟方法 noBackupDirectory(Z)Landroidx/sqlite/db/SupportSQLiteOpenHelper$Configuration$Builder;” - 在 WorkManager.initialize() 中。你见过这个吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-18
    • 2012-04-22
    • 1970-01-01
    • 2021-06-16
    相关资源
    最近更新 更多