Execution failed for task ':shared:podInstall' - android

I am very new to KMM (Kotlin Multiplatform Mobile) and iOS development (including CocoaPods). I have come across the following build error in Android Studio.
Execution failed for task ':shared:podInstall'.
java.io.IOException: Cannot run program "pod" (in directory "/Users/.../AndroidStudioProjects/.../iosApp"): error=2, No such file or directory
The directory definitely exists and I seem to be able to manually run pod commands from within the directory. I am not sure but it seems like this problem came about when I updated the Kotlin plugin from 1.5.0 to 1.5.10. This problem occurred even when starting a completely new KMM project.
I thought it might have something to do with Android Studio not being able to find the pod command so I added it to the path but that didn't seem to do anything. Any help with this would be appreciated.

Check your Gradle JDK :
Android Studio > Preferences > Build, Execution, Deployment > Build Tools > Gradle
Then select Gradle JDK -> Embedded JDK
Maybe you must execute in command line :
./gradlew :shared:podInstall

Have you tried File > Invalidate Cache and Restart?
I had exactly same issue, but It got fixed after invalidate cache and restart.

Related

debug directory does not exist error running React-native's AwsomeProject

I'm trying to create a react-native android app following react-native "Getting started" here but when I try to run it both through CLI and with Android studio it gives me this error:
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource compilation failed
AAPT: C:\Windows\System32\AwsomeProject\android\app\build\intermediates\res\merged\debug: error: directory does not exist.
I tried deleting the build folder, cleaning the project and re-running it but it doesn't work.
How can I solve this?
If I understand your situation right:
There is absolutely no issue in your Java and XML.
Your project built just fine before this.
You tried to remove the build cache.
In addition to above you should remove the .gradle directory as well.
Unfortunately, some react-native modules have their own build directory inside the node_modules/ directory, so it is possible that you didn't clear the build cache for them.
Of course, it's really hard to go into each module and remove the build cache manually each time, but fortunately, you can change this behavior by adding to build.gradle file something like below:
allprojects {
// ...
buildDir = "${rootProject.rootDir}/.build/${project.name}"
}
Note: This tells gradle to use the same build directory for all projects.
I prefer ".build" as build directory but you may want to change that to "build" in above.

Can't build my android project after move it to another computer

I can't build my android project in react native project, i just used this project in my old computer and it built fine, but after i clone it from my new macbook i get error.
I tried to delete the cache folder and it didn't help.
The error that i get:
FAILURE: Build failed with an exception.
What went wrong:
Could not open settings remapped class cache for espedq8f7vbnwrshulq11juyl (/Users/(UserName)/.gradle/caches/5.0/scripts-remapped/settings_3tlaqtt0fziq08p73u9gmyutn/espedq8f7vbnwrshulq11juyl/settingsa9190c3ddc71e1450eb3f3e7bc6a334f).
Could not open settings generic class cache for settings file '/Users/(UserName)/Desktop/MyApp/friendsapp/client/android/settings.gradl' (/Users/(UserName)/.gradle/caches/5.0/scripts/espedq8f7vbnwrshulq11juyl/settings/settingsa9190c3ddc71e1450eb3f3e7bc6a334f).
BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 57
Yes i found the answer!
I just clicked in android studio, FILE -> sync project with gradle files .
It did the magic !
Edit
Help me so many times for building:
yarn add jetifier
yarn run jetify
rebuild project in android studio
To clear Android Studio's cache and bring it out of its state of confusion, select 'File > Invalidate Caches / Restart' and then click the 'Invalidate and Restart' button.
You should invalidate caches from android studio not deleting cache folder directly.

cannot find symbol class R android studio 3.0.1

cannot find symbol class R
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
I think the project xml design contains any error. in that case R file could not be created. So please verify the xml file if no such error found then rebuild the project using Build → Clean Project / Rebuild Project
Check if there are any errors in your build.gradle (Module: app) file, and then sync it by using the refresh button from the Gradle panel.
Build > Clean Project, and then Build > Rebuild Project
I have been using MacBook Pro for my Android development, but I don't shut down but use the sleep mode normally. Because of this, my Android Studio gets out of control occasionally. Therefore, by simply restarting your entire development PC might resolve your issue.
Alternatively, you can try File > Invalidate Caches/Restart to clean up all the related caches.
Make sure that you have imported import <package_name>.R; (you can use Alt + Enter), than clean and rebuild your project (Build → Clean Project / Rebuild Project)
Note: Sometimes importing R file could not resolve the issue

On Unity 2018.1 Android gradle build failing with 'library uses same package'

This issue appears after update to Unity 2018.1. On 2017.3.1 version everything worked fine.
Gradle version: 3.3
Android Plugin version: 2.3.3
Does anyone have an idea how to fix following error?
CommandInvokationFailure: Gradle build failed.
C:/Program Files/Java/jdk1.8.0_131\bin\java.exe -classpath "C:\Program Files\Unity2018\Editor
\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-4.0.1.jar"
org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx2048m" "assembleRelease"
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ': processReleaseResources'.
> Error: A library uses the same package as this project: com.unity3d.player
The problem was caused by Simple Android Notifications Free asset (https://assetstore.unity.com/packages/tools/integration/simple-android-notifications-free-68626).
AndroidManifest file in simple-android-notifications.aar contains package="com.unity3d.player"
After renaming it to "com.hippogames.simpleandroidnotifications" I now able to build APK.
The strange thing is that the same library was successfully used with Unity 2017.3.1 and plugin worked as expected.
I tried million things, but only this solved my problem:
When adding facebook sdk package to assets, it creates Facebook SDK folder, and plugins are in it. So :
1. I moved everything from inside Facebook SDK folder to Assets folder.
2. Then I go to Assets/PlayServicesResolver/AndroidResolver/Force Resolve (Don't know if this is necessary).
It appears that unity couldn't find the path to plugins for android. I lost 5 days in searching the solution.
follow these steps and rebuild the project
Goto File from unity top Menu
Select Build Settings
From Build Setting click on Player Settings
In Player Setting Inspector Menu Select Other Settings
See for Identification->Package Name
change Package Name to something unique like com.yourname.appname
and save the project and build again

Gradle test run fails after class rename

We have Gradle set up to build and test our Android app. Now we ran into the problem, that Gradle test runs fail reproducibly after a class was renamed somewhere in the project:
Execution failed for task ':PROJ:compileDebugUnitTestJavaWithJavac'.
> Unable to read class file: '/path/to/class/with/the/name/before/renaming.class'
This error is reproducible both..
locally (run gradle tests from Android Studio, or on command line using ./gradlew test), and
remotely, when the tests run on our CI (a Teamcity server).
What solves the issue, is manually triggering a rebuild locally (e.g. in Android Studio Build > Rebuild Project) or re-running the Teamcity task with the flag clean all files in the checkout directory before the build set.
Is there any way we can get our tests to not fail after a class has been renamed?
While the above solution is simple enough it is kinda annoying that a simple rename which makes it to our repo will blow up the CI builds... We really want those to stay green. :)
This is a known issue in Gradle 2.14 and 2.14.1 and there will be a workaround for it in upcoming Android Gradle plugin release.
As a workaround you can do a clean build for your project. For a CI build, a clean build is a good idea anyway.
You could use the Swabra build feature of TC that cleans out the working directory either before or after each build, so that all generated files are blown away and the build always starts with a clean working copy. For reproducible builds this is a must-be-used feature in my opinion.
Alternatively you can of course also add the clean Gradle task to your TC configuration so that Gradle cleans away previous build artefacts. But if using TC I'd prefer Swabra as it restores VCS state reliably.

Categories

Resources