我正在尝试在android studio中运行该项目,它给出了一个完整的错误:-
Android资源编译失败 C:\ Users \ mohammadfarooq \ Desktop \ MaterialWallpaper \ app \ src \ main \ res \ layout \ layout_recent_wallpaper.xml: 2: 错误:格式不正确(令牌无效)。 C:\ Users \ mohammadfarooq \ Desktop \ MaterialWallpaper \ app \ src \ main \ res \ layout \ layout_recent_wallpaper.xml: 错误:文件无法编译。
<?xml version="1.0" encoding="utf-8"?>1<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootlayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridView
android:id="@+id/latest_grid"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:layout_above="@+id/adView" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
ads:adSize="BANNER"
android:visibility="@string/admob_visibility"
ads:adUnitId="@string/admob_publisher_id" />
答案 0 :(得分:2)
问题在这里
<?xml version="1.0" encoding="utf-8"?>
1<RelativeLayout
1
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="@+id/rootlayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridView
android:id="@+id/latest_grid"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:layout_above="@+id/adView" />
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
ads:adSize="BANNER"
android:visibility="@string/admob_visibility"
ads:adUnitId="@string/admob_publisher_id" />
</RelativeLayout>
答案 1 :(得分:0)
从布局XMl的第一行中删除1。
1