android studio error - Could not determine the dependencies of task ':app:installDebug' - android-studio

While running the React Native Android app, then building the project the following error is shown:
Could not determine the dependencies of task ':app:installDebug'.

Go to android folder in your project and then type
gradlew clean for Windows and
./gradlew clean for Mac and Linux. I use this method every time I encounter the same problem, and also when changing the package.json (add / remove library)

Please remove build folder in /android/app and run build command again.
It worked for me.

Related

Ionic 5 capacitor android project not sync

Android studio keeps building and install the first android project into the device.
I have tried
npx cap sync
npx cap copy android
Even delete the /android folder and add it again. The project still remains as the first time I added into the android studio. I have tried 'Gradle sync' and 'Invalidate cache /restart' still no luck.
I have update my project resource icon and splash to a customized one, but the android project still using the capacitor default icon and splash. Have anyone face this issue before?
I found the solution!
I notice the npx sync is copying data from the www folder. Thus, I think I need to update the www folder first before sync. Thus I use the
ionic build
Command, to build all the files into www and run
npx cap sync
npx cap open android
Tada, android project is updated.
Every time you perform a build (e.g. ionic build) that changes your web directory (default: www), you'll need to copy those changes down to your native projects:
ionic build or npm run build
npx cap copy
npx cap open android
reference : https://capacitor.ionicframework.com/docs/getting-started/with-ionic
if you are using the ionic commands the all you have to do is call ionic capacitor sync... it will do all of the building and the copying of assets
https://ionicframework.com/docs/cli/commands/capacitor-sync

Flutter in Android Studio: Build Bundle/APK greyed out

I installed Flutter and Android Studio following this link here:
https://flutter.dev/docs/get-started/editor
I've been coding in flutter for two months now and can run my app in simulator or on a connected device no problem.
But when I try to actually build an apk via "Build" --> "Build Bundle(s) / APK", this option is greyed out.
Android Studio: 3.3.2
You can't build apk using Build option in Android Studio if you are running your Flutter project.
There are 2 solutions to build it.
In terminal, write flutter build apk (this will build apk for release version not the debug version)
Open your module in Android Studio and you can use Build option of the Android studio to build the debug apk.
For option 2, you can go to build.gradle file and you should see an option in Android Studio asking you to open the module separately (see the screenshot) Tap on this option and you can then build your apk in both debug and release mode.
I realize this might have already been answered, but I have another solution to this issue. I was having the same problem after modifying my pubspec.yaml file, so after trying to build within terminal nothing would happen. Apparently, you have to open the .yaml file within Android Studio from your project directory in order to for AS to realize that there's been a change to the file. After I opened the file from the project folder, the option for Build > flutter > Build Bundle(s) /APK > Build App Bundle finally reappeared again. Just sharing my experience and hope it can help someone else who may come across this rather strange issue.
Reopen the project from your projects directory, not from recent projects option. This solved for me
Please follow these steps:-
Go To Project Structure>Project>NOSDK
Change NOSDK to the latest
ANDROID API PLATFORM
Then go to MODULE and DO THE SAME

Error:This project does not use the Gradle build system, even though it was build in gradle system before

My project was build initally with bradle build system in android studio after I switching branches in git I got the following error.
This project does not use the Gradle build system. We recommend that you migrate to using the Gradle build system.
When i try exetuting gradle task I get error :
Error:Android Source Generator: [project-name] AndroidManifest.xml file not found , Even though I have the file in proper place.
I have been trying to fix this from several days. I have tried re-importing the project, clone the project again. Any help is gladly welcome.
Thanks,

This version of android studio is incompatible with the gradle version used.Try disabling the instant run

I am able to build the app properly, but when I run it I get this error:
This version of android studio is incompatible with the gradle version used.Try disabling the instant run
You can use normal build run rather than instant run.
Check first
Go to Settings/Preferences > Build, Execution, Deployment option > Instant Run and uncheck all the three boxes.
Upgrading Gradle services URL:
Project > Gradle > Wrapper > gradle-wrapper.properties
Change URL from
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
to
distributionUrl=https\://services.gradle.org/distributions/gradle-2.11-all.zip
(Find latest distributionUrl gradle plugin version Here: http://services.gradle.org/distributions
**Make sure to use gradle-x.xx-all.zip
)
Delete your build folder
When you run project, build folder will be created automatically
Go to BUILD option in menu > Clean the project, Build the project
It should work without instant run.
I had easy steps & correct way also
1 - In Settings -> Build, Execution, Deployment option -> Instant Run
2 - Clear Enable instant run to hot swap code
3 - Clean project
p/s : It should totally work.
The Gradle Plugin used is typically the same as the version of Android studio you are using.
Check the Android Studio version
Help → About
and the version will read
Android Studio Version X.Y.Z
Then, go to
Project → Gradle Scripts → build.gradle(Project)
and under dependencies change the classpath to
classpath 'com.android.tools.build:gradle:X.Y.Z'
and rebuild/sync the project.
You can disable instant run by follow these steps in Android Studio:
File → Settings → Preferences dialog → Build → Execution → Deployment
→ Instant Run → Update Project
This feature introduced in Android Studio 2. however, when you disable it, next time when you try to push new app to your emulator is running much slower.
In my case I just update Android Studio to the latest build from canary channel and it's works without disable this feature.
Hope it's help
As commented by sjd: Just cleaning the project and build again might help if you, just like me, have used the automatic update applied by android studio.
I just did a Build > Clean project and then reRun app!
I wanted to run the app in debug mode and got the same message, so I tried:
File > Invalidate caches and restart...
Clean project
Build project
Nothing worked...
Then, I just clicked on the green arrow to run the project without debugging...
Worked!
So then I just added a debugging session with the option left of the stop button in Android Studio.
I did fix by this way.
Update your classpath to classpath 'com.android.tools.build:gradle:2.0.0' in your top level build.gradle file.
Done
I just Deleted the Build Folder and Clean project.It worked for me...!!!
In Android Studio 2.3.3
File -> Settings -> Build, Execution, Deployment -> Instant Run -> Unable Instant Run to hot swap code (Uncheck it)
Now, you have disable Instant Run...
It will solve Instant Run issue.

Phonegap 3.4.0 fails to build new projects and update old projects

I recently updated phonegap, node, and npm. I have an existing project I previously built with Phonegap version 3.3.0. I then attempted to update my existing project using phonegap platform update ios and received an error stating that the '/platforms' directory does not exist.
I don't think it makes any difference, but I also tried to use the cordova command instead of the phonegap command, but I just get the same error as above. I even created a completely new project with phonegap create Test and I am able to get a project built successfully, but when I try to run/build I get a similar error: Error: /platforms does not exist. Please specify an existing parent folder. [error] /Users/mftcmbp1/.cordova/lib/ios/cordova/3.4.0/bin/create: Command failed with exit code 1 Even stranger, I am able to successfully create a project with the cordova command, build ios and android platforms, and emulate the project, yet I can't do this with the phonegap command like I could before I updated.Any help or suggestions of why this would be occurring will be helpful.
Thanks!
Not sure if there is a bug with Phonegap 3.4.0, but I fixed my issue by uninstalling the latest Phonegap version and installing Phonegap version 3.3.0-0.19.4.
1- you need to 'cd' to your project and add platform first before build
cd Test
2- then add platform
iOS
phonegap platform add ios
android
phonegap platform add android
3- then you can build your project
iOS
phonegap build ios
android
phonegap build android
I ran into this over the weekend, have you tried:
$ mkdir project_directory/platforms
As I remember it, that solved the issue as a hotfix.
The error occured after a project was cloned from github without the platforms directory.
I ran into the same issue, and it looks like an error in the update script, and specifically this file:
node_modules/phonegap/node_modules/cordova/src/util.js
The quick fix is, in the function isRootDir, to change "config.xml" to ".cordova", i.e.:
- if (fs.existsSync(path.join(dir, 'config.xml'))) {
+ if (fs.existsSync(path.join(dir, '.cordova'))) {
The old version identified the base project directory via the existence of the .cordova directory. The new version is incorrectly looking for a directory that contains these three items:
www/
config.xml
platforms/
config.xml should not be in the base directory, it's under www/, which is why it fails.
The script does have fail-safe, which is to look for www/config.xml. However, the way it does this is to continue traversing the tree towards root, and if at any time it finds another www/config.xml, will assume this is a better candidate for the project directory.
In your situation, I'm guessing you have a /www/config.xml off of your root directory, and PhoneGap is erroneously thinking that is your project directory.

Resources