在调试清单中获取错误。通过禁用AAPT2找到了一种解决方法,但我宁愿找到问题的根源。除了错误之外,还有“此处不允许”和“未注册URI”的各种属性(仅在调试清单中)。
调试/ AndroidManifest.xml中
<?xml version="1.0" encoding="utf-8"?>
<!-- suppress ALL -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sam.duluthbikes"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="20"
android:targetSdkVersion="25" />
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera2"
android:required="false" />
<meta-data
android:name="android.support.VERSION"
android:value="25.3.0" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:debuggable="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name="com.example.sam.duluthbikes.MenuActivity"
android:label="@string/title_activity_maps" >
</activity>
<activity android:name="com.example.sam.duluthbikes.MainActivity" />
<fragment android:name=".AboutFragment" />
<fragment android:name=".DiscountFragment" />
<fragment android:name=".EventsFragment" />
<fragment android:name=".ReportFragment" />
<fragment android:name=".ToursFragment" />
<fragment android:name=".RideHistoryFragment" />
<activity android:name="com.example.sam.duluthbikes.EndRideActivity" />
<activity
android:name="com.example.sam.duluthbikes.LoginActivity"
android:label="@string/title_activity_maps" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.common.api.GoogleApiActivity"
android:exported="false"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
主/ AndroidManifest.xml中
<?xml version="1.0" encoding="utf-8"?>
<!--suppress ALL -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.sam.duluthbikes">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera2" android:required="false" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<activity
android:name=".MenuActivity"
android:label="@string/title_activity_maps">
</activity>
<activity android:name=".MainActivity" />
<fragment android:name=".AboutFragment" />
<fragment android:name=".DiscountFragment" />
<fragment android:name=".EventsFragment" />
<fragment android:name=".ReportFragment" />
<fragment android:name=".ToursFragment" />
<fragment android:name=".RideHistoryFragment" />
<activity android:name=".EndRideActivity" />
<activity
android:name=".LoginActivity"
android:label="@string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
错误
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources, :app:compileDebugSources]
C:\Users\barda\Desktop\College\Fall2017\SoftwareEngineering\GroupBikes\duluthBikes-master\duluthBikes-master\android\app\build\intermediates\manifests\full\debug\AndroidManifest.xml
Error:(72) error: unknown element <fragment> found.
Error:(73) error: unknown element <fragment> found.
Error:(74) error: unknown element <fragment> found.
Error:(75) error: unknown element <fragment> found.
Error:(76) error: unknown element <fragment> found.
Error:(77) error: unknown element <fragment> found.
Error:(72) unknown element <fragment> found.
Error:(73) unknown element <fragment> found.
Error:(74) unknown element <fragment> found.
Error:(75) unknown element <fragment> found.
Error:(76) unknown element <fragment> found.
Error:(77) unknown element <fragment> found.
Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 1s
Information:16 errors
Information:0 warnings
Information:See complete output in console
答案 0 :(得分:1)
您可能有一个打开的目录,该目录在该文件夹上有一个锁。因此,IDE无法在重新编译期间将其删除。
如果您检查是否打开了该窗口-请先关闭该文件夹,然后运行
Build-> clean项目。
然后
Build-> rebuild project它可能对您有用。
您可以尝试的另一件事是删除中间文件夹并从头开始重建它们。简而言之,该问题与构建文件的缓存有关。
答案 1 :(得分:0)
尝试:构建 - &gt;清理项目,然后重新构建项目