简体   繁体   中英

Gradle Build Errors in Android Studio

It's my first time using Android Studio, or developing an Android app in general, so I'm sorry if it's an obvious error.

When I try to build my app I get errors, as seen below.

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:compileDebugAndroidTestSources, :app:compileDebugUnitTestSources, :app:compileDebugSources]
H:\Stage_3\CEG3799_Individual_Research_Project\App\CEG3799\app\build\intermediates\manifests\full\debug\AndroidManifest.xml
    Error:(36) error: unknown element <activity> found.
    Error:(36) unknown element <activity> 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 4s
> Information:6 errors
> Information:0 warnings
> Information:See complete output in console

The debug file it is referring to is https://pastebin.com/Yyc1wGDL . The main AndroidManifest.xml file is https://pastebin.com/kj978xd4 . If I try and move my <activity> to inside my <application> , I get the following error instead.

Error:Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

This is the console / logs that I can find https://pastebin.com/pT1m0GLZ . The build.gradle is at https://pastebin.com/6r5ys8Fi

Can anyone help advise me how to get this working? Thank you in advance

Move the

<activity
       android:name="uk.ac.ncl.b5027438.CEG3799.MainActivity"
       android:configChanges="screenSize|orientation" />

inside the <application> node

When you move <activity> inside <application> you'll have two <activity> tags with the same android:name="uk.ac.ncl.b5027438.CEG3799.MainActivity" . delete one of these tags

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM