在我引用的所有类中的每个实例中R.id.something,它R都是红色的,并且表示"无法解析符号R".此外,每次有R.layout.something红色下划线并说"无法解析方法setContentView(?)".该项目总是很好.一直看到这一点很烦人.我在这里已经阅读了许多关于类似的东西的其他问题,但大部分涉及从Eclipse导入项目.我正在使用我认为最新版本的Android Studio,该项目是使用Android Studio创建的,并且没有任何"无法解决R"问题.如果有人知道,我想知道是什么原因造成的.
我刚刚开始学习和使用“Android Studio”软件并编辑项目。我们花了很长时间才弄清楚如何使用它。我刚刚修复了许多错误,现在我知道了很多关于错误的事情,但是一件事发生在我身上,这让我发疯了!我无法修复这个错误,也不知道出了什么问题。这是错误:
> Task :app:processReleaseResources FAILED
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml"}],"original":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml: AAPT: error: style attribute 'android:attr/contextPopupMenuStyle' not found.\n ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml"}],"original":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml: AAPT: error: style attribute 'android:attr/contextPopupMenuStyle' not found.\n ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml"}],"original":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml: AAPT: error: style attribute 'android:attr/contextPopupMenuStyle' not found.\n ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml"}],"original":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml: AAPT: error: style attribute 'android:attr/contextPopupMenuStyle' not found.\n ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml"}],"original":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml: AAPT: error: style attribute 'android:attr/dialogCornerRadius' not found.\n ","tool":"AAPT"}
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml"}],"original":"C:\\Users\\****\\.gradle\\caches\\transforms-2\\files-2.1\\b635fd2d4b36b21da676271add72c19b\\material-1.4.0-alpha01\\res\\values\\values.xml: AAPT: error: style attribute …Run Code Online (Sandbox Code Playgroud) 我试图在项目中使用以下库(版本2.0.1),但是一旦尝试将其添加到gradle文件并构建项目,我就开始收到此错误。
Android resource linking failed
Output: C:\Users\me\androidProject\kite\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:8642: error: style attribute 'attr/textColorError (aka com.app.kite:attr/textColorError)' not found.
error: failed linking references.
Command: C:\Users\me\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\355577d385562aabb3c69eea7f88a383\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
C:\Users\me\AppData\Local\Android\Sdk\platforms\android-28\android.jar\
--manifest\
C:\Users\me\androidProject\kite\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
C:\Users\me\androidProject\kite\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@C:\Users\me\androidProject\kite\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
C:\Users\me\androidProject\kite\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--proguard-main-dex\
C:\Users\me\androidProject\kite\build\intermediates\legacy_multidex_aapt_derived_proguard_rules\debug\processDebugResources\manifest_keep.txt\
--custom-package\
com.app.kite\
-0\
apk\
--output-text-symbols\
C:\Users\me\androidProject\kite\build\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
Run Code Online (Sandbox Code Playgroud)
我将支持库更新为,28.0.0但是不起作用。我的编译和目标SDK版本28并buildToolsVersion为28.0.3。这是我的gradle文件中的库依赖项。
implementation 'com.github.mukeshsolanki:android-otpview-pinview:2.0.1'
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?谢谢!!
我是Android的新手,并尝试使用Android Studio 3.3.2版开发Hello应用程序。我正在尝试创建“默认导航活动”项目及其在构建过程中出现的如下错误。
Android resource linking failed
error: resource style/Animation.AppCompat.Dialog (aka com.example.myapplication:style/Animation.AppCompat.Dialog) not found.
error: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.example.myapplication:style/Theme.AppCompat.Light.DarkActionBar) not found.
error: resource style/ThemeOverlay.AppCompat.Dark.ActionBar (aka com.example.myapplication:style/ThemeOverlay.AppCompat.Dark.ActionBar) not found.
F:\MyApplication2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:401: error: style attribute 'attr/windowActionBar (aka com.example.myapplication:attr/windowActionBar)' not found.
F:\MyApplication2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:402: error: style attribute 'attr/windowNoTitle (aka com.example.myapplication:attr/windowNoTitle)' not found.
F:\MyApplication2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v21\values-v21.xml:8: error: style attribute 'attr/windowActionBar (aka com.example.myapplication:attr/windowActionBar)' not found.
F:\MyApplication2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v21\values-v21.xml:9: error: style attribute 'attr/windowNoTitle (aka com.example.myapplication:attr/windowNoTitle)' not found.
error: resource style/ThemeOverlay.AppCompat.Light (aka com.example.myapplication:style/ThemeOverlay.AppCompat.Light) not found.
F:\MyApplication2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:416: error: resource style/Widget.AppCompat.ListView.Menu (aka com.example.myapplication:style/Widget.AppCompat.ListView.Menu) not found.
F:\MyApplication2\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:417: …Run Code Online (Sandbox Code Playgroud)