[英]Why is my native android code in Flutter showing errors?
I am testing platform specific coding with Flutter.我正在使用 Flutter 测试平台特定的编码。 I opened the android folder in Android Studio, wrote my code and it shows no errors.
我在 Android Studio 中打开了 android 文件夹,编写了我的代码,它没有显示任何错误。 I then moved back to Flutter which is underlining in red the Rs in the code below.
然后我回到 Flutter,它在下面的代码中用红色下划线 Rs。 However, the app is working fine.
但是,该应用程序运行良好。 I am wondering why an error is showing and what I can do to remove these red lines.
我想知道为什么会显示错误以及如何删除这些红线。 I would be grateful for pointers.
我将不胜感激。
Here is my code:这是我的代码:
public class MyTileService extends TileService {
private final int STATE_ON = 1;
private final int STATE_OFF = 0;
private int toggleState = STATE_ON;
@Override
public void onTileAdded() {
System.out.println("onTileAdded");
}
@Override
public void onTileRemoved() {
System.out.println("onTileRemoved");
}
@Override
public void onStartListening() {
System.out.println("onStartListening");
}
@Override
public void onStopListening() {
System.out.println("onStopListening");
}
@Override
public void onClick() {
System.out.println("onClick state = " + Integer.toString(getQsTile().getState()));
Icon icon;
if (toggleState == STATE_ON) {
toggleState = STATE_OFF;
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_spa_black_24dp);
System.out.println("OFF");
} else {
toggleState = STATE_ON;
icon = Icon.createWithResource(getApplicationContext(), R.drawable.ic_star_border_black_24dp);
System.out.println("ON");
}
getQsTile().setIcon(icon);
getQsTile().updateTile();
}
} }
I tried cleaning the android project, uninstalling and reinstalling Flutter and Dart plugins, checking flutter doctor.我尝试清理android项目,卸载并重新安装Flutter和Dart插件,检查flutter doctor。
Here is an image:这是一张图片:
Flutter projects are not Gradle-based Android projects so a number of features provided by Android Studio are not available to Flutter programmers.
Flutter 项目不是基于 Gradle 的 Android 项目,因此 Android Studio 提供的许多功能对 Flutter 程序员来说是不可用的。
This still is a Flutter Plugin.这仍然是一个 Flutter 插件。
Is documented here:记录在这里:
And you can track it here:你可以在这里跟踪它:
It seems that the first item is check, so it's only a metter of time to wait this milestone to be released.似乎第一项是检查,所以等待这个里程碑发布只是一米的时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.