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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。