这是我第一次在应用程序中安装Android_intent插件,在实验过程中,我在简单的应用程序中安装了插件,并且插件运行良好,但是当我在应用程序中执行相同的操作时,我实际上有了一个插件,更长的时间。但是当我安装它时,出现了这样的错误:
/home/denis/AndroidStudioProjects/spmi_conference/build/android_intent/generated/source/buildConfig/debug/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:23: error: duplicate class: io.flutter.plugins.androidintent.AndroidIntentPlugin
public class AndroidIntentPlugin implements MethodCallHandler {
^
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:13: error: package io.flutter.plugin.common does not exist
import io.flutter.plugin.common.MethodCall;
^
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:14: error: package io.flutter.plugin.common does not exist
import io.flutter.plugin.common.MethodChannel;
^
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:15: error: package io.flutter.plugin.common.MethodChannel does not exist
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
^
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:16: error: package io.flutter.plugin.common.MethodChannel does not exist
import io.flutter.plugin.common.MethodChannel.Result;
^
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:17: error: package io.flutter.plugin.common.PluginRegistry does not exist
import io.flutter.plugin.common.PluginRegistry.Registrar;
^
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:23: error: cannot find symbol
public class AndroidIntentPlugin implements MethodCallHandler {
^
symbol: class MethodCallHandler
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:25: error: cannot find symbol
private final Registrar mRegistrar;
^
symbol: class Registrar
location: class AndroidIntentPlugin
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:28: error: cannot find symbol
public static void registerWith(Registrar registrar) {
^
symbol: class Registrar
location: class AndroidIntentPlugin
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:34: error: cannot find symbol
private AndroidIntentPlugin(Registrar registrar) {
^
symbol: class Registrar
location: class AndroidIntentPlugin
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:117: error: cannot find symbol
public void onMethodCall(MethodCall call, Result result) {
^
symbol: class MethodCall
location: class AndroidIntentPlugin
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:117: error: cannot find symbol
public void onMethodCall(MethodCall call, Result result) {
^
symbol: class Result
location: class AndroidIntentPlugin
/home/denis/AndroidStudioProjects/spmi_conference/build/android_intent/generated/source/buildConfig/debug/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:13: error: package io.flutter.plugin.common does not exist
import io.flutter.plugin.common.MethodCall;
^
/home/denis/AndroidStudioProjects/spmi_conference/build/android_intent/generated/source/buildConfig/debug/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:14: error: package io.flutter.plugin.common does not exist
import io.flutter.plugin.common.MethodChannel;
^
/home/denis/AndroidStudioProjects/spmi_conference/build/android_intent/generated/source/buildConfig/debug/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:15: error: package io.flutter.plugin.common.MethodChannel does not exist
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
^
/home/denis/AndroidStudioProjects/spmi_conference/build/android_intent/generated/source/buildConfig/debug/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:16: error: package io.flutter.plugin.common.MethodChannel does not exist
import io.flutter.plugin.common.MethodChannel.Result;
^
/home/denis/AndroidStudioProjects/spmi_conference/build/android_intent/generated/source/buildConfig/debug/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:17: error: package io.flutter.plugin.common.PluginRegistry does not exist
import io.flutter.plugin.common.PluginRegistry.Registrar;
^
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:29: error: cannot find symbol
final MethodChannel channel =
^
symbol: class MethodChannel
location: class AndroidIntentPlugin
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:30: error: cannot find symbol
new MethodChannel(registrar.messenger(), "plugins.flutter.io/android_intent");
^
symbol: class MethodChannel
location: class AndroidIntentPlugin
/home/denis/Documents/DENISDATA/Jobs/2018/test/flutter/development/flutter/.pub-cache/hosted/pub.dartlang.org/android_intent-0.3.0+2/android/src/main/java/io/flutter/plugins/androidintent/AndroidIntentPlugin.java:116: error: method does not override or implement a method from a supertype
@Override
^
20 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':android_intent:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
我已经尝试了好几天。 我的代码错了吗? 有人能帮我吗?谢谢 最好的问候。
答案 0 :(得分:1)
将此代码添加到项目的android构建Gradle文件中。
subprojects {
project.evaluationDependsOn(':app')
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx')) {
details.useVersion "1.0.1"
}
}
}
}
在再次尝试之前,请不要忘记清理项目。
答案 1 :(得分:0)
我只是在另一个插件上遇到了同样的问题,却发现很少有用的信息。最终对我有用的步骤是:
升级gradle版本:
android/gradle/wrapper/gradle-wrapper.properties
中,我切换为使用5.4.1 android/build.gradle
中,我切换到classpath 'com.android.tools.build:gradle:3.5.1'
确保使用了AndroidX支持库:
android/app/build.gradle
中,这是将所有android.support
前缀切换为androidx.support
(和分别将com.android.support
切换为com.androidx.support
的问题。根据我的实验,我认为是问题的根本原因是#2-的确,步骤1可能是完全不必要的,但是当我试图找出原因时似乎是一个合理的起点。问题是。
由于您没有提供有关gradle属性的信息,因此我只能基于遇到的构建问题的相似性来假设您面临类似的问题。