无法解析导入项目上的方法R。(应用内计费版本3)在Android Studio.4.2中

无法解析导入项目上的方法R。(应用内计费版本3)在Android Studio.4.2中,android,import,android-studio,in-app-billing,Android,Import,Android Studio,In App Billing,我导入了应用内计费V3(来自谷歌的示例)。在android manifest中更改包或更改程序的目标SDK然后重建时,突然找不到R方法 有人见过这个吗 安卓清单 <!-- Copyright (c) 2012 Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compli

我导入了应用内计费V3(来自谷歌的示例)。在android manifest中更改包或更改程序的目标SDK然后重建时,突然找不到R方法

有人见过这个吗

安卓清单

    <!--
      Copyright (c) 2012 Google Inc.

      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.android.trivialdrivesamplemotok"
    android:versionCode="3"
    android:versionName="1.3" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <!-- VERY IMPORTANT! Don't forget this permission, or in-app billing won't work. -->
    <uses-permission android:name="com.android.vending.BILLING" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.android.trivialdrivesample.MainActivity"
            android:label="@string/title_activity_main"
            android:screenOrientation="portrait"
             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>


检查您的xml文件(布局)以及清单xml文件是否存在错误。这些xml中的任何错误都将阻止项目生成R文件。另外,请确保布局中没有任何元素需要比您选择作为目标SDK的SDK级别更高的SDK级别。

您将IInAppBillingService.aidl放在哪里了?这是一个来自谷歌应用内计费的示例。。我认为这不是一个gradle项目。@GabrieleMariotti它可以在com.android.vending.billing中找到也许如果你重命名一个包,它不仅仅是重命名清单上的包?我想,我找到了答案,当你在安卓清单上更改包时,你还应该折射你的文件夹。Android Studio不会这样做。这是一个来自谷歌的示例。我认为没有错误。嗯,我仔细检查了一下,我想没有错误。