0

This happen when I rebuild, Below is the error, I don't know how to fix it:

Error:15:11:37.950 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    15:11:37.951 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
    15:11:37.951 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    15:11:37.951 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
    15:11:37.951 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Cannot read packageName from C:\Users\Dell\AndroidStudioProjects\LearnAdvent\app\src\main\AndroidManifest.xml
    15:11:37.951 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
    15:11:37.951 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
    15:11:37.951 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace.

My package name declare in manifest, I'd tried to clean then rebuild, but still doesn't work.

note: the package name in manifest same with applicationID in build.gradle

Clay
  • 1
  • 2
  • What do you mean you cannot read the package name? In the code i cannot see you reading package name any where? – Abdul Waheed Sep 24 '17 at 07:31
  • i can ofc, the error said like that :Error:FAILURE: Build failed with an exception. * What went wrong: Cannot read packageName from C:\Users\Dell\AndroidStudioProjects\LearnAdvent\app\src\main\AndroidManifest.xml * Try: Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. – Clay Sep 24 '17 at 07:42
  • ohh.. did you try to clean the project and rebuild it? – Abdul Waheed Sep 24 '17 at 07:43
  • yes, but its not working bro... as u see the package name, i dont change and still the same since i start. – Clay Sep 24 '17 at 07:46
  • when did it start happening first time? What action did you perform with your build? – Abdul Waheed Sep 24 '17 at 07:53
  • let me know one thing is the application id in gradle file and package name in manifest are same? – Abdul Waheed Sep 24 '17 at 07:58
  • 2. yes bro, its same... before i can run or debug my app... just this afternoon, its cant be. – Clay Sep 24 '17 at 08:18
  • 1. this is login activity – Clay Sep 24 '17 at 08:18
  • try copying the `AndroidManifest.xml` to a new file and use replace the original file with it. Sometimes windows will messing your project file. And try to not place your project file in `drive C:`. Move it to somewhere else. – ישו אוהב אותך Sep 24 '17 at 08:23
  • Get more error output. https://stackoverflow.com/questions/21674091/how-to-add-stacktrace-or-debug-option-when-building-android-studio-project – OneCricketeer Sep 24 '17 at 08:28
  • Can you show the full gradle file? As far as I know, `applicationId` actually overrides what's defined in the XML anyway – OneCricketeer Sep 24 '17 at 08:44
  • i update it already bro, the build gradle above – Clay Sep 24 '17 at 09:32
  • Did one of the answers below help you? If yes, please consider accepting it ... – Binarus Oct 11 '17 at 17:24

1 Answers1

0

I have never done Android development; however, I'd like to give the following hints:

  1. I currently can't see the package name in your manifest, so this might be the problem (in your version from some minutes ago, before you have edited your question, the package name was in the manifest).

  2. If the package name is in the manifest and the error persists, then it might help to re-read and think about the error message. It says it can't read the package name from C:\Users\Dell\AndroidStudioProjects\LearnAdvent\app\src\main\AndroidManifest.xml.

This could have the following reasons:

  • The manifest might not be at the place where Android looks for it. So double check that your manifest really is in the folder C:\Users\Dell\AndroidStudioProjects\LearnAdvent\app\src\main and that it is really named AndroidManifest.xml.

  • There might be problems with the access permissions. Double check if the file and folder permissions allow you to do any operation which is needed with the folder C:\Users\Dell\AndroidStudioProjects\LearnAdvent\app\src\main as well with the file AndroidManifest.xml.

  • An application might have locked that manifest file so that your development tools can't access it. This could happen if an application (possibly one of the development tools) did not close cleanly when you ended it or when it has done its work. So restarting your PC might help. Alternatively, you could try to identify and end processes which lock that file using appropriate tools. Since we should not recommend tools here, you could search on superuser.com for them.

Binarus
  • 4,005
  • 3
  • 25
  • 41
  • Package was always in the manifest. Question had bad formatting – OneCricketeer Sep 24 '17 at 08:27
  • yup, packagae was always in manifest. then ive been searching for 4 hours where the hell the bad formatting and i still cant find it, haha. T_T – Clay Sep 24 '17 at 08:33