无法访问,它给了我这个logcat错误
AGPBI: {"kind":"error","text":"Tag \u003cItem\u003e can not appear inside \u003cstring-array\u003e, only \u003citem\u003e","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\src\\main\\res\\values\\strings.xml","position":{"startLine":6,"startColumn":4,"startOffset":298,"endLine":10,"endColumn":19,"endOffset":429}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Base.Widget.AppCompat.DrawerArrowToggle.Common\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-hdpi-v4\\values-hdpi-v4.xml","position":{"startLine":2}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027barLength\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\exploded-aar\\com.android.support\\appcompat-v7\\23.4.0\\res\\values-hdpi-v4\\values-hdpi-v4.xml","position":{"startLine":2,"startColumn":4,"startOffset":55,"endLine":6,"endColumn":13,"endOffset":327}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027drawableSize\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\exploded-aar\\com.android.support\\appcompat-v7\\23.4.0\\res\\values-hdpi-v4\\values-hdpi-v4.xml","position":{"startLine":2,"startColumn":4,"startOffset":55,"endLine":6,"endColumn":13,"endOffset":327}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027gapBetweenBars\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\exploded-aar\\com.android.support\\appcompat-v7\\23.4.0\\res\\values-hdpi-v4\\values-hdpi-v4.xml","position":{"startLine":2,"startColumn":4,"startOffset":55,"endLine":6,"endColumn":13,"endOffset":327}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Base.Widget.Design.TabLayout\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-sw600dp-v13\\values-sw600dp-v13.xml","position":{"startLine":22}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027tabGravity\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\exploded-aar\\com.android.support\\design\\23.4.0\\res\\values-sw600dp-v13\\values-sw600dp-v13.xml","position":{"startLine":11,"startColumn":4,"startOffset":677,"endLine":14,"endColumn":12,"endOffset":854}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027tabMode\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\exploded-aar\\com.android.support\\design\\23.4.0\\res\\values-sw600dp-v13\\values-sw600dp-v13.xml","position":{"startLine":11,"startColumn":4,"startOffset":677,"endLine":14,"endColumn":12,"endOffset":854}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Base.Widget.Design.TabLayout\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-land\\values-land.xml","position":{"startLine":8}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027tabGravity\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\exploded-aar\\com.android.support\\design\\23.4.0\\res\\values-land\\values-land.xml","position":{"startLine":2,"startColumn":4,"startOffset":55,"endLine":5,"endColumn":12,"endOffset":232}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"No resource found that matches the given name: attr \u0027tabMode\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\exploded-aar\\com.android.support\\design\\23.4.0\\res\\values-land\\values-land.xml","position":{"startLine":2,"startColumn":4,"startOffset":55,"endLine":5,"endColumn":12,"endOffset":232}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Base.Theme.AppCompat.Dialog.FixedSize\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-large-v4\\values-large-v4.xml","position":{"startLine":13}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Base.Theme.AppCompat.Light.Dialog.FixedSize\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-large-v4\\values-large-v4.xml","position":{"startLine":14}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Theme.AppCompat\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-night-v8\\values-night-v8.xml","position":{"startLine":2}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Theme.AppCompat\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-night-v8\\values-night-v8.xml","position":{"startLine":3}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Theme.AppCompat.Dialog\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-night-v8\\values-night-v8.xml","position":{"startLine":4}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Theme.AppCompat.Dialog.Alert\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-night-v8\\values-night-v8.xml","position":{"startLine":5}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Theme.AppCompat.Dialog.MinWidth\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-night-v8\\values-night-v8.xml","position":{"startLine":6}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Theme.AppCompat.DialogWhenLarge\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-night-v8\\values-night-v8.xml","position":{"startLine":7}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Theme.AppCompat.NoActionBar\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-night-v8\\values-night-v8.xml","position":{"startLine":8}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Base.V7.Theme.AppCompat.Dialog\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-v11\\values-v11.xml","position":{"startLine":40}}],"original":"","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Error retrieving parent for item: No resource found that matches the given name \u0027Base.V7.Theme.AppCompat.Light.Dialog\u0027.","sources":[{"file":"C:\\Users\\Squirrel\\Documents\\MyCodes\\ClickAwayTechnologies\\app\\build\\intermediates\\res\\merged\\debug\\values-v11\\values-v11.xml","position":{"startLine":45}}],"original":"","tool":"AAPT"}
经过简短的研究,我了解到我的错误原因是
<string-array name="tabs">
<Item>Tab 1</Item>
<Item>Tab 2</Item>
<Item>Tab 3</Item>
</string-array>
我正在尝试解决它,但我无法获得解决它的最佳方法,可以帮上忙。
我的代码的这一部分
pager.setAdapter(new viewPagerAdapter(getSupportFragmentManager()));
pager.setOnPageChangeListener(new pager.SimpleOnPageChangeListener() {
public void onPageSelected(int position) {
tabHost.setSelectedNavigationItem(position);
}
});
由于无法识别功能而显示错误
SimpleOnPageChangeListener()
如果我也能解决这个问题,我也将不胜感激
最佳答案
就我而言,我必须更改compileSDKVersion
以匹配支持库版本以摆脱此错误。
我的支持库版本为27.1.1
,而compileSDKVersion
为23
。将compileSDKVersion
更改为27
,从而修复了错误。