本文介绍了Android的工作室:摇篮:错误:找不到符号变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作我的应用程序,一切正常,直到我试图在java中显示的图像。

I was working on my app and everything was normal until I tried to display image in java.

我跑的应用程序一次,它跑了正常,被显示的图像。之后,它要求我输入一些图书馆,我进口他们。从那以后,我得到了错误,我的活动。

I ran the app once and it ran normally, the picture was displayed.After that it asked me to import some libraries and I imported them. After that I got errors for my activities.

这样的错误:

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我已经导入这些库:

In MainActivity I have imported these libraries:

import android.R;
import android.content.Intent;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Button;

和在secondActivity这些:

and in secondActivity these:

import android.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

有谁知道如何解决这个问题?

Does anyone know how to fix this?

编辑:我删除进口android.R; ,现在,它正常工作

I deleted import android.R; and now it works normally.

推荐答案

您不能导入 android.R 。这应该自动生成和认可。 这个问题包含了很多有用的技巧,如果你得到一些错误引用研究删除在导入后。

You shouldn't be importing android.R. That should be automatically generated and recognized. This question contains a lot of helpful tips if you get some error referring to R after removing the import.

去除进口,经过一些基本的步骤,如果这些错误的出现:

Some basic steps after removing the import, if those errors appear:

  • 清洁你的构建,然后重建
  • 确保有XML文件中的任何错误或错别字
  • 确保您的资源名称由的[A-Z0-9] 。首都或符号是不允许的某些原因。
  • Clean your build, then rebuild
  • Make sure there are no errors or typos in your XML files
  • Make sure your resource names consist of [a-z0-9.]. Capitals or symbols are not allowed for some reason.

这篇关于Android的工作室:摇篮:错误:找不到符号变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 12:05