- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了一个 Android 库,当我的客户尝试将其导入到名为 mylocusmapsapplication 的项目的模块级 build.gradle 文件中时,该库无法链接。客户的应用程序中几乎没有任何内容,它是在 Android Studio 中通过转到 File > New > New Project... > Empty Activity 创建的。然后我们简单地将我的库添加为依赖项。但是当他们尝试编译时,它给出了以下错误:
/Users/michaelosofsky/.gradle/caches/transforms-2/files-2.1/9f0df0bf18c337fe1883aef0ec2959c5/jetified-locuslabs-android-sdk-3.0.1/res/layout/ll_levels_selector_coordinator.xml:9:AAPT: error: attribute layout_behavior (akacom.example.mylocusmapsapplication:layout_behavior) not found.
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
但是,随后我们收到了一个新错误:
/Users/michaelosofsky/.gradle/caches/transforms-2/files-2.1/9f0df0bf18c337fe1883aef0ec2959c5/jetified-locuslabs-android-sdk-3.0.1/res/layout/ll_levels_selector_coordinator.xml:9:AAPT: error: resource string/bottom_sheet_behavior (akacom.example.mylocusmapsapplication:string/bottom_sheet_behavior) notfound.
implementation "com.google.android.material:material:1.3.0-alpha02"
然后客户能够编译、链接和运行他们的项目。
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
implementation "com.google.android.material:material:1.3.0-alpha02"
对此:
api "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
api "com.google.android.material:material:1.3.0-alpha02"
我重新发布了我的库,但是当我的客户在没有上述解决方法的情况下自行尝试我的库的新版本时,他们看到了相同的错误消息。
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout 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:background="@color/ll_darkDarkTranslucent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/llLevelSheetLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
app:layout_behavior="@string/bottom_sheet_behavior">
我相信
app:layout_behavior
属性在 :coordinatorlayout: 库中定义,其值
@string/bottom_sheet_behavior
在 :material: 库中定义。
java.lang.NoClassDefFoundError
在运行时。
implementation "androidx.coordinatorlayout:coordinatorlayout:1.1.0"
implementation "com.google.android.material:material:1.3.0-alpha02"
implementation "com.mapbox.mapboxsdk:mapbox-android-sdk:9.0.0"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "org.kamranzafar:jtar:2.2"
implementation "org.tukaani:xz:1.5"
implementation "com.jakewharton.retrofit:retrofit2-kotlin-coroutines-adapter:0.9.2"
implementation "me.xdrop:fuzzywuzzy:1.2.0"
implementation "androidx.fragment:fragment-ktx:1.3.0-alpha07"
我能够找到一些关于
retrofit
的类似问题的引用资料。图书馆,有人使用与我相同的解决方法:
https://github.com/square/retrofit/issues/3266#issuecomment-632362066
最佳答案
感谢@pavneet-singh,我们找到了解决这个问题的方法。 @megasoft78 是正确的,根本原因是我的库被错误地打包。这是更正后的 module-level build.gradle file对于我的图书馆:
// This must go at the top of build.gradle
plugins {
id 'maven-publish'
}
// This can go anywhere in the build.gradle
// I have removed my values wherever it says <MY_XXX> below
project.afterEvaluate {
publishing {
// How to package the library
publications {
library(MavenPublication) {
from components.release
groupId = '<MY_GROUP_ID>'
artifactId = '<MY_ARTIFACT_ID>'
version = '<MY_ARTIFACT_VERSION_NUMBER>'
}
}
// Where to publish the library (GitLab Package Registry in my case)
repositories {
maven {
url "https://gitlab.com/api/v4/projects/<MY_GITLAB_GROUP_ID>/packages/maven"
name "GitLab"
credentials(HttpHeaderCredentials) {
name = 'Job-Token'
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header(HttpHeaderAuthentication)
}
}
}
}
}
关键变化是
publications
堵塞。以下不正确的 block 是导致问题的原因:
publications {
library(MavenPublication) {
groupId = '<MY_GROUP_ID>'
artifactId = '<MY_ARTIFACT_ID>'
version = '<MY_ARTIFACT_VERSION_NUMBER>'
artifact bundleReleaseAar
}
}
注意我正在使用
GitLab's Package Registry而不是
JitPack.io因为当我成为付费客户后,JitPack.io 的客户服务就没有响应了。
关于android - 如何打包我的 Android 库,以便我的客户不会遇到像 "AAPT: error: attribute layout_behavior"这样的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63961378/
调试了3天还是没解决。如果你们中有人知道问题的根源以及我如何解决它,那我会很高兴?请原谅我不知道有更好的方法来粘贴错误消息。 错误日志: Cause 1: java.util.concurrent.E
最近,我将我的 android-SDK 升级到了 Android M(API 22,MNC 预览版)。之后,每个项目打开Eclipse都报错。 错误说:“执行 aapt 时出错。请检查 aapt 是否
我在 Visual Studio 2017 中有一个 cordova 应用程序项目,到目前为止一直在构建良好。没有对项目进行任何更改。 现在我们遇到了这个构建错误: 1>MSBUILD : cordo
每当我尝试在一些更改后第二次运行 android 项目时,我都会收到此错误。如果我关闭模拟器错误消失。但是每次都关闭模拟器不是一个可行的解决方案。我应该怎么做才能摆脱这个问题? Description
当我尝试构建和运行 Flutter 应用程序时,它向我显示以下消息: “无法找到 aapt。请确保您已安装 Android 构建工具。 异常(exception):构建 Android 应用程序时出现
我有一个奇怪的问题。在我的 bash 脚本或 Makefile 中,使用带有绝对路径的 aapt 不起作用,但如果我在本地目录中,它就起作用了。 如果我执行以下操作,它不起作用: aapt add $
aapt的输出格式是什么? 例如检查这里的输出 http://elinux.org/Android_aapt config 0 lang=-- cnt=-- orien=0 touch=0 densi
我已经尝试通过 Java 程序执行 aapt 命令已有一段时间了。我的预感是我应该使用 runtime.exec() 命令来实现这一点。但是,我查看了其他问题和答案,但似乎没有一个对我有用。命令是:
尝试使用 Maven 构建 Android 项目,我们无法使用它使用 google play services apklib 编译它。 我已经尝试从 apklib 中删除所有语言,只保留默认语言,它似
我想在带有 android sdk(文件夹/build-tools/24.0.1)的 Mac 上使用 aapt 命令。但是每当我尝试使用该命令时,我都会收到一条消息,提示找不到该命令 (aapt/aa
当我在 Windows 7 下列出正在运行的进程时,大约有 20 个 aapt.exe 进程正在显示,它们占用了大量内存。打开 android studio 时会发生这种情况。我总是被迫退出 andr
我的 Android 项目有一个 Ant 构建脚本。我正在使用 aapt 来打包各种资源文件。我想要解压缩资源文件。我试过“-0”标志,但文件仍然被压缩!但是当我通过 Eclipse 构建时,资源文件
我刚刚更新了 ADT,而不是 SDK,现在我只有一个项目存在这个问题,即我的 aapt 没有找到 Error executing aapt. Please check aapt is present
在使用eclipse进行安卓java的编程的时候,有时候我们会遇到这样的问题:那就是无故弹出aapt.exe停止工作的提示,虽然程序不会崩溃,但是这个提示经常弹出很是烦人。今天,小编就来教大家aap
我在使用 aapt 将资源打包到 apk 时遇到了一些麻烦。 .没有 @drawable/[...] 时一切正常或 @styles/[...]我的 AndroidManifest.xml 中的方向.但
我正在尝试将lib com.android.support:preference-v7:23.1.0导入到我的项目中。 但是,当我添加 compile ("com.android.support:pr
我尝试使用 android studio 构建一个 android 应用程序。当我尝试构建时,Gradle 抛出此错误: Gradle invocation completed successfull
我想以编程方式创建打包的资源文件(这就是问题),直接在 Android 手机上运行的应用程序中创建。有没有办法在手机上执行“aapt.exe”,或者有其他方法从java库创建resource._rsc
最近我一直在尝试构建一个 Android NDK 应用程序,该应用程序在过去编译和打包时没有问题。但是由于系统更新或 SDK 更新,有些东西发生了变化,现在当我尝试构建应用程序时,出现以下错误: /h
我有原始资源,偶尔会在构建之间交换或修改,但文件名不会更改,而 aapt 不会合并这些更改;它使用以前版本的 bin/MyThing.ap_(我猜这是他们被藏起来的地方)。来自 ant debug:
我是一名优秀的程序员,十分优秀!