Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android环境下gradle依赖mirai报错 #2402

Closed
kagg886 opened this issue Dec 21, 2022 · 12 comments
Closed

Android环境下gradle依赖mirai报错 #2402

kagg886 opened this issue Dec 21, 2022 · 12 comments

Comments

@kagg886
Copy link

kagg886 commented Dec 21, 2022

问题描述

引入并重新刷新项目并未被打断,只是报了一个黄
image
但重新构建时报红
image

复现

implementation("net.mamoe:mirai-core-android:2.13.2") {
    exclude module: "net.mamoe:mirai-core-api"
    exclude module: "net.mamoe:mirai-core-utils"

}
implementation("net.mamoe:mirai-core-api-android:2.13.2") {
    exclude module: "net.mamoe:mirai-core-utils"
}
implementation("net.mamoe:mirai-core-utils-android:2.13.2")

mirai-core 版本

2.13.2

bot-protocol

ANDROID_PHONE

其他组件版本

No response

系统日志

在补充信息的 log.txt中

网络日志

No response

补充信息

log.txt

@cssxsh
Copy link
Contributor

cssxsh commented Dec 21, 2022

请检查 NDK 版本

@kagg886
Copy link
Author

kagg886 commented Dec 22, 2022

请检查 NDK 版本

问题是,我没配置过NDK
应该是我没装过NDK

@kagg886
Copy link
Author

kagg886 commented Dec 22, 2022

image

@Him188
Copy link
Member

Him188 commented Dec 23, 2022

试试只添加依赖:

implementation("net.mamoe:mirai-core:2.13.2")

这个我测试过在我机器上是可以用

@kagg886
Copy link
Author

kagg886 commented Dec 25, 2022

试试只添加依赖:

implementation("net.mamoe:mirai-core:2.13.2")

这个我测试过在我机器上是可以用

问题是,我就是如此引入的,然后报错,查了issue后改成这样的x
image

新建 文本文档.txt

@zhaodice
Copy link
Contributor

zhaodice commented Jan 1, 2023

恐怕是仓库信息没配好哦

@StageGuard
Copy link
Member

给你个参考

runtimeOnly("net.mamoe:mirai-core-android:$mirai_version") {
    exclude module: 'atomicfu', group: 'org.jetbrains.kotlinx'
}
api("net.mamoe:mirai-core-api-android:$mirai_version")
implementation("net.mamoe:mirai-core-utils-android:$mirai_version")

@Karlatemp
Copy link
Member

Karlatemp commented Jan 1, 2023

添加 org.jetbrains.kotlin.android 插件 或

configurations.all {
    attributes {
        attribute(Attribute.of("org.jetbrains.kotlin.platform.type", String.class), "androidJvm")
    }
}

@kagg886
Copy link
Author

kagg886 commented Jan 2, 2023

添加 org.jetbrains.kotlin.android 插件 或

configurations.all {
    attributes {
        attribute(Attribute.of("org.jetbrains.kotlin.platform.type", String.class), "androidJvm")
    }
}

正解,解决了,谢谢qaq

@kagg886 kagg886 closed this as completed Jan 2, 2023
@Karlatemp Karlatemp mentioned this issue May 1, 2023
@Noctiro
Copy link

Noctiro commented May 5, 2023

@Him188
Copy link
Member

Him188 commented May 5, 2023

@ObcbO 试试 预览版本号: 2.15.0-dev-85 在 https://github.com/mamoe/mirai/blob/dev/docs/UsingSnapshots.md 查看如何使用预览版本

Noctiro added a commit to Encinet/OceanBot that referenced this issue May 6, 2023
@Noctiro
Copy link

Noctiro commented Jun 5, 2023

@ObcbO 试试 预览版本号: 2.15.0-dev-85 在 https://github.com/mamoe/mirai/blob/dev/docs/UsingSnapshots.md 查看如何使用预览版本

最新版2.15.0-M1还是出现此错误

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants