neu_ZZM 2021-11-25 14:48 采纳率: 100%
浏览 72
已结题

【Android编程】在引入其他包后,报错“Cannot resolve symbol 'R'”

我的主程序是在

package com.example.myapplication;

下写的,然后引入了一个

package com.uuzuche.lib_zxing.activity;

这个包。在这个新包下的所有R均报错Cannot resolve symbol 'R,例如:

setContentView(R.layout.camera);

但是我在项目里是有camera这个文件的,camera.xml内容如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:background="#00B8EB"
        android:orientation="horizontal">

        <ImageButton
            android:id="@+id/imageButton3"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:contentDescription="@string/empty"
            android:padding="0dp"
            android:paddingStart="0dp"
            android:paddingLeft="0dp"
            android:paddingTop="0dp"
            android:paddingEnd="0dp"
            android:paddingRight="0dp"
            android:paddingBottom="0dp"
            android:scaleType="centerCrop"
            android:scaleX="0.7"
            android:scaleY="0.7"
            app:srcCompat="@drawable/fanhui" />

        <View
            android:id="@+id/view"
            android:layout_width="10dp"
            android:layout_height="wrap_content"
            android:layout_weight="1" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="150dp"
            android:layout_height="50dp"
            android:layout_weight="1"
            android:gravity="center|start"
            android:text="@string/erweima"
            android:textColor="#ffffff"
            android:textSize="20sp" />
    </LinearLayout>

    <FrameLayout
        android:id="@+id/fl_zxing_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </FrameLayout>

</LinearLayout>

这个文件也只有2k,也不存在网上说的过大问题,请问各位这是什么回事呢

  • 写回答

2条回答 默认 最新

  • 立青_ 2021-11-25 15:34
    关注

    报错的地方截个图看看

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 12月3日
  • 已采纳回答 11月25日
  • 创建了问题 11月25日

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog