0
› Building app...
Configuration on demand is an incubating feature.

FAILURE: Build failed with an exception.

* What went wrong:
Task 'lint' not found in root project 'my project'. Some candidates are: 'init'.

* Try:
> Run gradlew tasks to get a list of available tasks.
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s
E:\Application\daastradingapp\android\gradlew.bat exited with non-zero code: 1
Error: E:\Application\daastradingapp\android\gradlew.bat exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Users\Dennis_Liu\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:520:26)
    at ChildProcess.emit (events.js:400:28)
    at ChildProcess.cp.emit (C:\Users\Dennis_Liu\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
    ...
    at spawnAsync (C:\Users\Dennis_Liu\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:26:19)
    at spawnGradleAsync (C:\Users\Dennis_Liu\AppData\Roaming\npm\node_modules\expo-cli\src\commands\run\android\spawnGradleAsync.ts:83:18)
    at assembleAsync (C:\Users\Dennis_Liu\AppData\Roaming\npm\node_modules\expo-cli\src\commands\run\android\spawnGradleAsync.ts:57:16)
    at actionAsync (C:\Users\Dennis_Liu\AppData\Roaming\npm\node_modules\expo-cli\src\commands\run\android\runAndroid.ts:143:9)

I cannot find the problem from the error :

What went wrong: Task 'lint' not found in root project 'My Project'. Some candidates are: 'init'.

Recently I have expo sdk 44 bare workflow. Then I upgrade it to sdk 45 following this blog

https://blog.expo.dev/expo-sdk-45-f4e332954a68

After upgrading, Then I try to upgrade my Gradle Plugin AGP and Gradle Version.

This is my gradle version :

distributionUrl=https://services.gradle.org/distributions/gradle-7.3.3-bin.zip

And this is my AGP Version :

classpath("com.android.tools.build:gradle:7.2.0")

According to the documentation here :

https://developer.android.com/studio/releases/gradle-plugin

For Plugin AGP for the latest version : 7.2 We should use Gradle Version 7.3.3+

I also remove jcenter() from project/android => build.gradle because cause error.

After all hardwork and investigation I found some thread post from the stackoverflow :

React Native installRelease Task 'installRelease' not found in root project 'timeReportTool'. Some candidates are: 'uninstallRelease'

Android Studio build fails with "Task '' not found in root project 'MyProject'."

But it is not clear what cause the problem from my side. I cannot run expo run:android or npm run android. It always say :

What went wrong:

Task 'lint' not found in root project 'my project'. Some candidates are: 'init'.

I also cannot use gradlew clean. But I found some thread post from stackoveflow to add :

apply plugin:'base'

inside the path : android => build.gradle.

And it is working. Now I can use gradlew clean.

But after clean the gradle. The main error I mention and show at above still occured.

What is the solution to my error ? How I can run my expo run:android or npm run android. I use expo bare workflow from the start.

Any help will be appreciated. I have struggle for investigation for almost 3 days before I post and ask in here.

Thank You.

Dennis Liu
  • 2,268
  • 3
  • 21
  • 43

1 Answers1

0

I just reinstall the expo modules. from this https://docs.expo.dev/bare/installing-expo-modules/

npx install-expo-modules@latest

And it removed the error.

Dennis Liu
  • 2,268
  • 3
  • 21
  • 43