我无法构建我的应用程序,因为R.java不会更新ID.我更新了id,main.xml但旧的值仍然存在.这显然阻止了它的建立.有没有什么办法解决这一问题?我可以R.java通过重命名变量并保持引用保持不变来手动更新,还是不安全?除了下面发布的3行代码和未使用的变量警告之外,没有其他问题.
StopwatchAppActivity.java:
pauseBtn = (Button) findViewById(R.id.pause_btn);
resetBtn = (Button) findViewById(R.id.reset_btn);
timeDisp = (TextView) findViewById(R.id.time_tv);
Run Code Online (Sandbox Code Playgroud)
main.xml中:
<TextView
android:id="@+id/time_tv"
... />
<Button
android:id="@+id/pause_btn"
... />
<Button
android:id="@+id/reset_btn"
... />
Run Code Online (Sandbox Code Playgroud) 我在R.java文件中不断生成以下内容:
public static final class id {
public static final int =0x7f0500ae;
Run Code Online (Sandbox Code Playgroud)
我做了研究,它都指向了字符串文件.我检查了我的字符串文件,没有错误.应用程序不会在其他任何地方产生错误,只是生成这一行.
有人可以请帮助.
我刚刚将Android Studio更新为当前的0.3.1版本.因此,我开始得到一些我似乎无法理解的问题.首先,我在启动Android Studio时收到有关插件问题的消息.消息如下:
Plugin Error
Problems found loading plugins: Plugin "Android Designer" was not loaded:
required plugin "Android Support" is disabled.
Plugin "Google Cloud Tools For Android Studio" was not loaded:
required plugin "Android Support" is disabled.
Disable not loaded plugins Enable Android Support Open plugin manager
Run Code Online (Sandbox Code Playgroud)
最令人担忧的是 - 它基本上阻止了我目前的进展 - 是IDE无法解析R.xxx中的XML文件.比如这行:
setContentView(R.layout.activity_lists);
Run Code Online (Sandbox Code Playgroud)
它建议我使用android.R,由于不兼容性而导致进一步的错误.我不知道如何解决这个问题.在发生这种情况的另一个时刻,进一步的更新自动解决了这个问题.
我只是想学习 android 开发,并且正在使用最新版本的 android studio,但是,我在R.java文件夹树视图中找不到该文件:
我还清理并重建了我的项目,但仍然看不到.../source/R文件夹和R.java文件。
我正在开发一个工作正常的应用程序.
我尝试了一些新的布局文件但是当我构建项目时,没有生成R.java文件.我尝试了清理和构建项目,但仍然没有生成文件.
为什么会这样?
我现在应该怎么做才能重新生成文件?
在第二行的代码中,R.java中存在错误
public static final class id {
public static final int 2ndQ=0x7f05000a;
public static final int FirstQuestion=0x7f050000;
public static final int MainTitle=0x7f050003;
public static final int SecondQuestion=0x7f050008;
public static final int btnstrt=0x7f050007;
public static final int editText1=0x7f050001;
public static final int imageView1=0x7f050006;
public static final int maindescrip=0x7f050004;
public static final int radio0=0x7f05000b;
public static final int radio1=0x7f05000c;
public static final int radio2=0x7f05000d;
public static final int radioGroup1=0x7f050009;
public static final int toq1=0x7f050005;
public static final int toq2=0x7f050002;
public static final …Run Code Online (Sandbox Code Playgroud) 我在Android布局文件中出错(忘记了dp我的维度),并且在重建时,Android Studio替换了我的所有引用R.java(由于错误的构建,没有生成)android.R.java.这是正常的行为吗?如何禁用此功能?这是由允许自动导入引起的吗?
我刚刚创建了一个新的活动(project-> new-> android activity),我得到一个错误,其中R文件无法识别活动创建的布局.我使用Ubuntu 13.10(64位)
public class OrderKaraokeActivity extends SherlockActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_order_karaoke);
}
}
Run Code Online (Sandbox Code Playgroud)
activity_order_karaoke:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".OrderKaraokeActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

控制台:说明资源路径位置类型activity_order_karaoke无法解析或不是字段OrderKaraokeActivity.java/src/com/example/adicionalesprueba第18行Java问题
进口:

控制台问题:

我正在设计动作栏.我试图改变主动作栏的颜色.我在style.xml中编写了一个样式.直到我的项目工作正常.在我在xml文件中声明我的风格后,R.Java自杀了.以下是我编写的xml代码.我曾尝试过本网站提供的所有解决方案.他们都没有为我工作.
<resources>
<style name="MyCustomTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarStyle">@style/MyActionBarTheme</item>
</style>
<style name="MyActionBarTheme" parent="Widget.AppCompat.Light.ActionBar">
<item name="android:background">F757575</item>
</style>
</resources>
Run Code Online (Sandbox Code Playgroud)
谁来帮帮我
谢谢 :)
我想在 Android Studio 中使用 Java 代码更改操作栏的颜色,
我有颜色代码的 color.xml 文件
android.support.v7.app.ActionBar actionBar = getSupportActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(getColor(R.color.colorVelocity))); **//<<Error NullPointerException**
Run Code Online (Sandbox Code Playgroud)
告诉我如何解决这个问题,因为我想使用 R.color 我不想使用 color.parsecolor ("#hexcolor");
android ×10
r.java-file ×10
java ×4
eclipse ×2
background ×1
colors ×1
syntax-error ×1
textview ×1
xml ×1