How to solve Android Studio problems? - bash

Hello I have installed in my Ubuntu Android Studio with the intention of using them SDK with React Native, Cordova, Phonegap, etc.
I have searched other questions on this site and tried the solutions they offered, but the result so far is that what I show next, after 10 days installing and testing I have decided to ask my question.
I made the installation according to the official page of Android Studio and in several ways, but I can not get it to work.
Now I have the installation of the following way, to avoid problems of permissions:
Copy the downloaded folder from Android Studio to /usr/local/
For the SDK I chose a folder in my personal folder /home/charly/Android/sdk/
Install the necessary libraries for 32-bit sudo apt-get install libc6: i386 libncurses5: i386 libstdc ++ 6: i386 lib32z1 lib32bz2-1.0
To run the Android Studio installer, I placed it in the Android Studio location in the bin folder using the terminal:
cd/usr/local/android-studio/bin
Execute: ./studio.sh
I edit the .bashrc file: sudo vim ~/.bashrc and add the following to the end of the file:
export PATH=${PATH}:/home/charly/Android/sdk/tools
export PATH=${PATH}:/home/charly/Android/sdk/platform-tools
Install:
sudo apt-get install lib32stdc ++ 6
sudo apt-get install lib32z1
When I run android sdk and android avd the answer is: Order «android» not found. When should I take the SDK Manager and AVD Manager, respectively.
Also, there is another problem and when executing printenv ANDROID_HOME the result of the console is: /opt/android-sdk/ And in this folder is not Android Studio.
When I try to run an Android application from React Native: react-native run-android I get an error:
S server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug) ...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ': app'.
> The SDK directory '/ opt / android-sdk' does not exist.
* Try:
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 0s
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
Command failed: ./gradlew installDebug
Error: Command failed: ./gradlew installDebug
    at checkExecSyncError (child_process.js: 611: 11)
    at Object.execFileSync (child_process.js: 629: 13)
    at runOnAllDevices (/home/charly/proyec/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
    at buildAndRun (/home/charly/proyect/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
    at isPackagerRunning.then.result (/home/charly/proyect/App/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
    at process._tickCallback (internal / process / next_tick.js: 68: 7)
How can I solve these problems?
Why does it tell me that SDKs do not exist in '/opt/android-sdk' if I set up .bashrc to say they are in home/charly/Android/sdk?
Maybe the question is extensive, but I want to explain the whole installation and they can see the mistakes I've made in this one.
Thank you

You need to set the ANDROID_HOME environment variable in one of your bash startup scripts. This is explained in detail elsewhere on Stackoverflow.
Alternatively, you could add a local.properties file to configure the SDK location.

Related

Errors after update, BigSur 11.3 XCode 12.5 (12E262) React-Native and Expo

After upgrading BigSur to 11.3, Xcode to 12.5 and iOS to 14.5, I can't run the iOS app on a real device nor in the simulator.
React-Native -->
react-native run-ios
kikirim#Levent-MacBook-Pro test % react-native run-ios
error Could not find "Podfile.lock" at /Users/kikirim/Desktop/React-Native/test/ios/Podfile.lock. Did you run "pod install" in iOS directory?
info Found Xcode project "test.xcodeproj"
xcrun: error: active developer path ("/Volumes/MacOS/MacOs_Prog/Xcode-12.5.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
(node:5077) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
error Could not get the simulator list from Xcode. Please open Xcode and try running project directly from there to resolve the remaining issues.
Error: Command failed: xcrun simctl list --json devices
xcrun: error: active developer path ("/Volumes/MacOS/MacOs_Prog/Xcode-12.5.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:15)
at runOnSimulator (/Users/kikirim/Desktop/React-Native/test/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:164:54)
at Object.runIOS [as func] (/Users/kikirim/Desktop/React-Native/test/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:121:12)
at Command.handleAction (/Users/kikirim/Desktop/React-Native/test/node_modules/#react-native-community/cli/build/index.js:186:23)
at Command.listener (/Users/kikirim/Desktop/React-Native/test/node_modules/commander/index.js:315:8)
at Command.emit (events.js:315:20)
at Command.parseArgs (/Users/kikirim/Desktop/React-Native/test/node_modules/commander/index.js:651:12)
at Command.parse (/Users/kikirim/Desktop/React-Native/test/node_modules/commander/index.js:474:21)
at setupAndRun (/Users/kikirim/Desktop/React-Native/test/node_modules/#react-native-community/cli/build/index.js:265:24)
info Run CLI with --verbose flag for more details.
kikirim#Levent-MacBook-Pro test %
React-Expo -->
npm run ios
** BUILD FAILED **
The following build commands failed:
CompileC /Users/kikirim/Library/Developer/Xcode/DerivedData/text-gncpkkxvjxsnedbswzsxcynreivq/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper-Folly.build/Objects-normal/x86_64/DistributedMutex.o /Users/kikirim/Desktop/React-Native/text/ios/Pods/Flipper-Folly/folly/synchronization/DistributedMutex.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
It seems that there is an issue with Flipper. I am not using Flipper so i just commented it out.
cd ios
comment Flipper out from podfile:
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
run "pod deintegrate"
pod install
cd ..
npm run ios
You should update react native with following these steps:
https://react-native-community.github.io/upgrade-helper
Otherwise you will face with multiple issue.

NativeScript Linux Setup (Install Android SDK Platform 28 packages) failed

When following the official NativeScript installation for Linux (https://docs.nativescript.org/start/ns-setup-linux) you will get to Step 6: Install all packages for the Android SDK Platform 28.
If you just paste the mentioned command into the CLI like this:
sudo $ANDROID_HOME/tools/bin/sdkmanager "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"
It will fail with the following warrning:
Warning: Could not create settings
java.lang.IllegalArgumentException
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.<init>(SdkManagerCliSettings.java:428)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:152)
at com.android.sdklib.tool.sdkmanager.SdkManagerCliSettings.createSettings(SdkManagerCliSettings.java:134)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:57)
at com.android.sdklib.tool.sdkmanager.SdkManagerCli.main(SdkManagerCli.java:48)
The solution is to add the following flag to the command --sdk_root=${ANDROID_HOME} after you have set the ANDROID_HOME environment variable at step 3 (https://docs.nativescript.org/start/ns-setup-linux).
This appears to be a bug with the way sdkmanager locates the SDK installation folder. The whole command then looks like this:
sudo $ANDROID_HOME/tools/bin/sdkmanager --sdk_root=${ANDROID_HOME} "tools" "emulator" "platform-tools" "platforms;android-28" "build-tools;28.0.3" "extras;android;m2repository" "extras;google;m2repository"

Trying to lauch Appcelerator "Appcelerator CLI is currently installing or upgrading"

I was using the appcelerator and it asked me to upgrade, after this, the program was not responding, I closed it while the program was installing an update and when I tried to launch again, the program returned an error:
"Appcelerator CLI is currently installing or upgrading" [...]
Now I can't open the appcelerator.. and there aren't any process running for I can close and stop the "download"(if there is some download in process).
I don't know if there is some download in process and neither your progress...
I found a way to resolve.
Just delete ~/.appcelerator /.installing file
The problem is about Appcelerator Command Line . Make sure that you nstall the Appcelerator Command Line properly .
Follow the steps to Install the Appcelerator Command Line .
1. Ensure that you have Node.JS installed
node --version
If it works, you will see a version such as v0.10.37.
2. Install the Appcelerator CLI
sudo npm install appcelerator -g
3. After installation, you need to run setup to kick things off.
appc setup
Thanks
Pavel

Use of "sudo" has broken my Cordova

Someone made the mistake of using "sudo ionic add platform ios" and it has entirely broken my cordova for x-Code.
Nothing will build in x-code due to permission problems about accessing Cordova.
If I run "ionic platform add ios", it gives me:
Error: EACCES: permission denied, open '/Users/mac1/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.
During the build, it gives me a build failed message:
" CompileC build/stashd.build/Debug-iphonesimulator/stashd.build/Objects-normal/i386/MyMainViewController.o stashd/Plugins/com.telerik.plugins.wkwebview/MyMainViewController.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/mac1/Dev/John/ionic5/platforms/ios/cordova/build-debug.xcconfig,-project,stashd.xcodeproj,ARCHS=i386,-target,stashd,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/mac1/Dev/John/ionic5/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/mac1/Dev/John/ionic5/platforms/ios/build/sharedpch"
Trying to run in x-code it tells me
You don’t have permission to save the file “project.xcworkspace” in the folder “stashd.xcodeproj”.
Again- all this started to happen when Sudo was used (I never had to use it before, and ionic/Cordova worked perfectly).
So far I've:
Removed & re-installed Node.js, Ionic, NPM and Cordova. None have helped- I still require sudo.
First remove ios platform use sudo:
sudo ionic platform rm ios
or:
sudo rm -rf platforms
And then, delete files that can't be visited:
sudo rm ~/.config/configstore/update-notifier-cordova.json
And then, add ios platform without sudo:
ionic platform add ios
Hope this will help, regards.

Installed trigger app, installed node.js, trigger says it can't run npm on Mac

New Mac user account. I install the Trigger.io (TriggerToolkit) app for the Mac. It fires up a tab with the apps. I can run the iOS simulator from it - so it is plausibly working installation. I have installed node.js from the node.js website, using the Mac package.
I have node.js as /usr/local/bin/npm (version 1.1.43).
It is found when I type "npm" at a command line.
The path "/usr/local/bin" is on my $PATH.
"/usr/local/bin" is set in my /etc/paths file, system wide.
So the npm executable should be findable by any user, at any time (before or after login, running a terminal, etc).
When I use the web page for the web run, it's OK, until it tries to run npm.
[DEBUG] running run_web((), {})
[DEBUG] Running: npm install
[DEBUG] failed to run npm: do you have Node.js installed and on your path? while running run_web((), {})
[ERROR] failed to run npm: do you have Node.js installed and on your path?
I guess that the problem must be something to do with an assumption about the path for npm. What's the assumption? What can I symlink to make this work?
Note that npm is found by "forge run web". This is something specific to the way that TriggerToolkit.app is working.
Update: this is fixed as of v1.4.6:
http://docs.trigger.io/en/v1.4/release-notes.html#v1-4-6
Previous answer:
Unfortunately I think the error message here isn't great and reflects a general problem with starting the node app.
We are aware of one issue with dependencies which started occurring after Node 0.8. Can you check what Node version you have:
node --version
If it's 0.8, then a temporary workaround to this problem is to use the command line tools and:
forge build
Then manually update development/web/package.json to refer to express 2.5.10, then
forge run web
Sorry for the trouble, we'll report back here when that's fixed

Resources