Android 将Google Play Services库添加到现有项目后,aapt.exe已停止工作,无法解析R.java

Android 将Google Play Services库添加到现有项目后,aapt.exe已停止工作,无法解析R.java,android,google-ad-manager,Android,Google Ad Manager,我得到了解决方案。在下面发布解决方案。谢谢大家。 我正试图在我的旧项目中添加新的google-play-services_lib, 因此,从项目中删除R.jave文件。 而且,一旦我删除了google-play-services_lib,我就会得到我的R.java文件。 sdk的最低版本是11。 我指的是以下链接: 我按照以下步骤将库添加为项目==> 右键单击我的项目->Android中的属性->库部分,单击添加选择最近添加的项目->确定 然后aapt.exe停止工作,R.jave文件从项目中

我得到了解决方案。在下面发布解决方案。谢谢大家。

我正试图在我的旧项目中添加新的google-play-services_lib, 因此,从项目中删除R.jave文件。 而且,一旦我删除了google-play-services_lib,我就会得到我的R.java文件。
sdk的最低版本是11。 我指的是以下链接:

我按照以下步骤将库添加为项目==> 右键单击我的项目->Android中的属性->库部分,单击添加选择最近添加的项目->确定

然后aapt.exe停止工作,R.jave文件从项目中删除

  • 删除您的genbin文件夹
  • 清理并构建您的项目
  • 运行您的项目

  • 检查项目的“生成路径”部分。确保已选中“订单和导出”选项卡下的google_play_服务库。清理并刷新项目一次。还要检查xml文件中的任何错误。

    最后我得到了解决方案: 我在所有布局的每个视图中将(android:id=“@+id/)更改为(android:id=“@id/),并在res/values/ids.xml处创建一个新的资源文件,并提供其“名称”

    比如说

    步骤1:old_layout.xml

    <EditText  android:id="@+id/amount"                       
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
    <Button
                        android:id="@+id/submit"                       
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
    
    <EditText  android:id="@id/amount"                       
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
    
    
    <Button android:id="@id/submit"                       
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
    
    
    
    new_layout.xml

    <EditText  android:id="@+id/amount"                       
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
    <Button
                        android:id="@+id/submit"                       
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
    
    <EditText  android:id="@id/amount"                       
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content" />
    
    
    <Button android:id="@id/submit"                       
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
    
    
    
    步骤2:res/values/ids.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    <item type="id" name="amount" />
    <item type="id" name="submit" />
    </resources>
    
    
    
    步骤3:清理并运行项目


    这就是我的全部工作

    清理项目并重建它穆罕默德·扎伊格姆(Muhammad Zaighum)——多次尝试过清理项目。。不工作哪一个是您的最小sdk版本最小sdk版本是11。