skip to Main Content

enter image description herei have an android studio project with manifest file, the problem is when i sync the gradle it gives the error below

Gradle sync failed: Cannot get property 'sync' on null object

also this is the exception

    A problem occurred evaluating root project 'projectname'.
at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:93)
at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:210)
at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:66)
at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:63)
at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:49)
at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:63)
at org.gradle.configuration.project.BuildScriptProcessor$1.run(BuildScriptProcessor.java:45)
at org.gradle.internal.Factories$1.create(Factories.java:26)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:212)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:193)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:42)
at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:35)
at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject$1.run(LifecycleProjectEvaluator.java:107)
at org.gradle.internal.Factories$1.create(Factories.java:26)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:189)
at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withProjectLock(DefaultProjectStateRegistry.java:238)

7

Answers


  1. I have tried to rename and remove the line with include ':app' from my settings.gradle or settings.gradle.kts file, Sync Project with Gradle files and revert the removed line and sync again. but it does not work for me, what works for me is;

    1. delete folders [build, .idea, .gradle]
    2. resync or Invalidate Caches / Restart
    3. and do the same steps by removing include ':app', etc.

    Note: this works for me for my project that is configured with .kts files

    Login or Signup to reply.
  2. this works for me
    delete folders [build, .idea, .gradle]
    resync or Invalidate Caches / Restart
    and do the same steps by removing include ‘:app’, etc.

    Login or Signup to reply.
  3. I have commented

    include ':app'
    

    and it allowed me to build my project

    Login or Signup to reply.
  4. Synce gradle project again. It will be fixed!

    Login or Signup to reply.
  5. These steps helped me :

    1. delete folders [build, .idea, .gradle]
    2. resync or Invalidate Caches / Restart
    • after that restore deleted folders from Recycle Bin back cause project became corrupted. After that project works and can be build
    Login or Signup to reply.
  6. delete folders build,.idea,.gradle and resync or Invalidate Caches / Restart

    Login or Signup to reply.
  7. Works for me, but you needed to Update and Clean build everything first to proceed.

    PS: I was using Android Studio Flamingo 2022.2.1

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search