找不到adSize,Android Studio无法链接广告框架吗?

时间:2018-10-21 04:53:26

标签: android admob

我正在关注https://developers.google.com/admob/android/quick-start?hl=en-US#import_the_mobile_ads_sdk

<com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_alignParentBottom="true" ads:adSize="SMART_BANNER" ads:adUnitId="ca-app-pub-8143809646615023/6347460003"> > </com.google.android.gms.ads.AdView>

我在构建时遇到的错误:

```

Android resource linking failed
Output:  /Users/quantum/QuantumPilot/android/feature/src/main/res/layout/activity_main.xml:29: error: attribute adSize (aka quantumpilot.quantumproductions.com.quantumpilot.app:adSize) not found.
/Users/quantum/QuantumPilot/android/feature/src/main/res/layout/activity_main.xml:29: error: attribute adUnitId (aka quantumpilot.quantumproductions.com.quantumpilot.app:adUnitId) not found.
error: failed linking file resources.

Command: /Users/quantum/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/502ec8114256bc9343b789f7637adf71/aapt2-3.2.1-4818971-osx/aapt2 link -I\
        /Users/quantum/Library/Android/sdk/platforms/android-27/android.jar\
        --manifest\
        /Users/quantum/QuantumPilot/android/feature/build/intermediates/merged_manifests/debugFeature/processDebugFeatureManifest/merged/AndroidManifest.xml\
        -o\
        /Users/quantum/QuantumPilot/android/feature/build/intermediates/processed_res/debugFeature/processDebugFeatureResources/out/resources-debugFeature.ap_\
        -R\
        @/Users/quantum/QuantumPilot/android/feature/build/intermediates/incremental/processDebugFeatureResources/resources-list-for-resources-debugFeature.ap_.txt\
        --auto-add-overlay\
        --java\
        /Users/quantum/QuantumPilot/android/feature/build/generated/not_namespaced_r_class_sources/debugFeature/processDebugFeatureResources/r\
        --proguard\
        /Users/quantum/QuantumPilot/android/feature/build/intermediates/proguard-rules/feature/debug/aapt_rules.txt\
        --custom-package\
        quantumpilot.quantumproductions.com.quantumpilot.feature\
        -0\
        apk\
        --allow-reserved-package-id\
        --package-id\
        0x7e\
        -I\
        /Users/quantum/QuantumPilot/android/base/build/intermediates/processed_res/debugFeature/processDebugFeatureResources/out/resources-debugFeature.ap_\
        --no-version-vectors
Daemon:  AAPT2 aapt2-3.2.1-4818971-osx Daemon #0
```

0 个答案:

没有答案