我正在开发我的应用程序,一切都很正常,直到我尝试用java显示图像。
我运行了一次应用程序,它正常运行,图片显示。之后,它要求我导入一些库,然后我就导入了它们。在那之后,我的活动出了差错。
错误,如:
Gradle: error: cannot find symbol variable activity_main
Gradle: error: cannot find symbol variable button1
Gradle: error: cannot find symbol variable button2
Gradle: error: cannot find symbol variable textView
Gradle: error: cannot find symbol variable secondActivity在MainActivity中,我导入了这些库:
import android.R;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Button;在secondActivity中,这些:
import android.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;有人知道怎么解决这个问题吗?
编辑:我删除了import android.R;,现在它正常工作了。
发布于 2021-11-27 15:11:10
请确保您的包名在顶部正确,错误的包名可能会导致此问题。
https://stackoverflow.com/questions/18154499
复制相似问题