gpt4 book ai didi

cordova - ionic : compileSdkVersion is not specified

转载 作者:行者123 更新时间:2023-12-05 07:27:52 34 4
gpt4 key购买 nike

我正在尝试运行以下命令:

ionic cordova run android --device

但我收到以下错误

    BUILD FAILED in 3s
(node:3956) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
Failed to notify ProjectEvaluationListener.afterEvaluate(), but primary configuration failure takes precedence.
java.lang.IllegalStateException: compileSdkVersion is not specified.
at com.google.common.base.Preconditions.checkState(Preconditions.java:456)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:590)
at com.android.build.gradle.BasePlugin.lambda$null$3(BasePlugin.java:555)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.lambda$createTasks$4(BasePlugin.java:551)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy24.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:75)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:69)............

我尝试删除和添加 android 平台

ionic cordova platform rm android
ionic cordova platform add android

但是还是一样的错误。任何帮助,将不胜感激。谢谢。

最佳答案

我没有粘贴我在问题中收到的整个错误,因为 stackoverflow 不允许我发布,因为有很多“代码”(我应该将错误粘贴为简单文本,而不是代码)

无论如何,错误行之一是

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\xyz\idek\platforms\android\app\build.gradle' line: 95

因此,我查看了 app\build.gradle 中的第 95 行,它与我使用的 FCM 插件有关。所以我继续从我的应用程序中删除了该插件。

ionic cordova plugin rm cordova-plugin-fcm-with-dependecy-updated
npm uninstall --save @ionic-native/fcm

此外,您还必须在使用此插件的应用中注释代码。

现在我的应用程序成功运行了。我还没有找到为什么这个插件会导致问题。

编辑

FCM插件不工作的解决方案在这里https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated/pull/2

它所做的是,将 FCMPlugin.gradle 中的所有 jcenter() 替换为 mavenCentral()

关于cordova - ionic : compileSdkVersion is not specified,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53725213/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com