How to complete delete old programm pathes. SDK location - android

I manually install(double click on downloaded pakage -> install button in my linux mint) Android Studio. Setted up the environment. And then i tried to run
npx react-native run-android
i got "No SDK found at the specified location" and "No emulators found". But i could run emulator manually in Android Studio with some example projects.
I suffered couple hours. And from command flutter doctor -v i saw diferent pathes
Android SDK at /usr/lib/android-sdk
Android Studio at /opt/android-studio
These paths are different from those where I installed. My SDK at /home/some_word/android/sdk path for example.
And editing $PATH in the .bashrk and .profile files doesn't change the paths I've seen in flutter doctor.
So how can i change this old program pathes?
Or how do I securely uninstall a program so that its paths are completely cleared?

it's enough to completely unistall
sudo apt-get purge package_name

Related

Unity build error. [Failed to install the following Android SDK packages as some licences have not been accepted. ]

After I carried out some commands below on terminal to test my unity app with android emulators. My Unity project started failing build over and over again due to the same error in the pics below. If there is anybody who are familiar with this issue, would you give me advice to address it?
The command I carried out on terminal
1, export PATH=$PATH:/Users/userName/Library/Android/sdk/platform-tools
2, echo PATH=$PATH: /Users/userName/Library/Android/sdk
3, cd /Users/userName/Desktop/AppName.apk
4, adb install AppName.apk
The details of the error
enter image description here
enter image description here
For people who may face the same errors in the future,
The problem was there is no licences file in /Users/username/Desktop/2019.2.9f1/PlaybackEngines/AndroidPlayer/SDK.
So I copied the file from /Users/username/Library/Android/sdk and paste it to the unity directory above.
The errors was successfully addressed.
I wish nobody wasted their time anymore because of this error.
Open command prompt as admin and run
{path_to_sdk_folder}/tools/bin/sdkmanager.bat --licenses
and accept all.
If anyone else happens to run into this problem, and you are using Unity Hub, run the following command from Terminal.
$ find /Applications/Unity/Hub/Editor -name "sdkmanager" -exec {} --licenses \;
This will find all of the installed SDKs and check that all licenses are accepted. If they aren't, you will be prompted to accept.
You can run the command again to double-check everything is 100%.
Keep bumping into this now Unity manages the platforms, Android Studio then grumbles about it if you point Android Studio at the platforms location Unity is using.
On Windows the quick and dirty fix is to run Android Studio as administrator, it then does what it needs and you can then go back to running Android Studio normally.
Not sure what the effects are long term, but it appears to work for me. Especially as I am not using the platform that Android Studio is grumbling about.
However, clearly, this isn't a great solution as the SDK manager in Android Studio doesn't see the platforms Unity claims to have installed.
On a Windows machine, you'll need to find your sdkmanager.bat for your current version of Unity. For you this location could be something like
C:\Program Files\Unity\<version>\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat
or
C:\Program Files\Unity\Hub\Editor\<version>\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\tools\bin\sdkmanager.bat
Once you find this, you can execute it with the --licenses flag in Powershell or your shell of choice, like below. Make sure that you run your shell as an administrator.
.\sdkmanager.bat --licenses
You'll then be prompted to review any licenses that have yet to be accepted. Answering y to these will resolve the issue.
Kotaro is right.
For people who may face the same errors in the future,
The problem was there is no licences file in /Users/username/Desktop/2019.2.9f1/PlaybackEngines/AndroidPlayer/SDK.
So I copied the file from /Users/username/Library/Android/sdk and paste it to the unity directory above.
The errors was successfully addressed.
I wish nobody wasted their time anymore because of this error.
Cant comment so :
This is correct but make sure you open CMD with admin privileges as it wont save the licenses!
Go to src -> flutter -> flutter -> flutter_console
and type flutter doctor --android-licenses. Click y.

How can I correctly set up UiAutomatorViewer to inspect elements for testing Android apps with Appium?

When running uiautomatorviewer, I am getting the following NullPointerException error:
I have installed and set up Appium following the setup process and set up environment variables for ANDROID_HOME and the Android SDK. The uiautomatorviewer command is using a Path user variable that points to the directory Sdk/tools/bin, where the uiautomatorviewer.bat file is located. From everything I've read online, running this executable should open up the UiAutomatorViewer application, so I can inspect elements on my Android app. Why isn't this working?
The correct fix for this issue:
Java SDKs 9 and 10 do not work with Appium and the Android SDK. You have to uninstall the Java SDK for the more recent version and install the Java 8 SDK instead.
For Linux
Follow this process:
brew cask uninstall java # uninstall java9
brew tap caskroom/versions
brew cask install java8 # install java8
touch ~/.android/repositories.cfg # without this file, error will occur on next step
brew cask install android-sdk
For Windows
Open Add or Remove Programs menu and uninstall Java 9/10.
Install Java 8 using the installer.
Can you just reconnect the device and restart it and the uiautomator? But make sure the test script is not running in the background. Or you can kill the adb server and restart it again.
You can go and check if you forgot any steps in UIAutomatorViewer Tutorial: Inspector for Android Testing.
I was using uiautomatorviewer with corretto-11.0.13 (after some edits in a .bat file) until I upgraded Android Studio to 2021.2.1 (Chipmunk) (to solve another issue in the Android build) and the problem didn't disappear. Moreover, more problems appeared. uiautomatorviewer didn't work again.
I rolled back to Android Studio 4.1.1, restored a change done in the find_java.bat file, and it worked again.
You must add the following Android/sdk/tools/bin/ in the system environment variable.
If you are using window os, you can do it like following:
Right-click on ‘This PC’ and select Properties.
Click 'Advanced system settings' and select ‘Environmental Variables’ option
Under the 'System variables", select 'Path' and click 'Edit'
Click 'New" and add the path of Android/sdk/tools/bin/ in the like
C:\Users\\AppData\Local\Android\Sdk\tools\bin
then you will be able to run uiautomatorviewer command in the command prompt.
The alternative way is to open command prompt in Android/sdk/tools/bin/ folder and then run uiautomatorviewer command.

Android emulator without Studio launch error

I'm trying to install just the Android Emulator on my Mac, not the whole Android Studio.
So far I have:
1) Installed Android-SDK via Homebrew
brew cask install android-sdk
2) Added to my $PATH, and checked I have no other ANDROID related PATHS going on.
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
3) In terminal running
$ANDROID_SDK_ROOT
shows
/usr/local/share/android-sdk: is a directory
4) Created a new AVD in with AVDManager.
5) Try to run created AVD and get this error
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/usr/local/share/android-sdk]!
I also can't run 'emulator' from the command line, I CAN run avdmanager and sdkmanager fine.
I've checked the path which appears to be correct. The AVD is in the location of
/Users/<user>/.android/avd/test.avd
Where could I be going wrong?
I had the same issue on Linux, trying to build a Docker image for the emulator, and finally find out what the reason was by looking at the Android emulator source code.
I installed only the required SDK packages for emulator ("emulator" and one of the "system-images"), but the emulator program check if ANDROID_HOME or ANDROID_SDK_ROOT path contains the "platforms" and "platform-tools" directory, so I installed the "platform-tools" package and one of the "platforms" package and it worked.
Manually create those two empty directories should also be enough.

MAC - I can't open Android Device Monitor on Mac

I have opened it as an administrator and I don't want to install anything unnecessary.
When I tried to open Android Device Monitor through Android Studio: Tools > Android > Android Device Monitor. It always shows the following screen shot:
Screen shot that shows "An error has occurred"
I have found solutions for windows, but I did not find solutions for mac.
One piece from the log:
!ENTRY org.eclipse.osgi 4 0 2015-12-02 22:52:40.714
!MESSAGE Bundle reference:file:org.apache.lucene.core_2.9.1.v201101211721.jar#4 not found.
There are lots of similar lines like this showing "something not found".
So what is missing? How do I install the exact missing parts? Thanks! (There is no enough space for me to install everything from android studio.)
First of all update Android SDK Tools from SDK Manager
Open a terminal window
Navigate to your SDK
Locate the 'tools' folder
cd into it
run: sudo ./monitor
Type in your password
Hope it might solve your problem.
JPCS's solution worked for me; install Java 8 and then the Android Device Monitor will work:
First install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then update and install Java 8
$ brew update
$ brew cask install java
I followed some steps and after long hours struggle all things got sort it out and i got success to run device moniter on Mac OS x.
what i did ?
I installed Homebrew and used its some commands to install java , because its so easy to download and install java in terminal using home-brew. its very good tool to sort out java problems automatically . but here one thing is to keep in mind . which is below ->
when you install java using Homebrew then please make sure you are using same version of java and jre with android studio.in my case my android studio using jre_1.8.0 , so installed java8.
Their some steps to follow.
just paste in terminal to download Homebrew to your system.
1.) /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.) $ brew tap caskroom/versions
$ brew cask install java8.
this will download and install java 8 automatically to your mac OSx.i installed java 8 for my case,java 9 is also available but i used java8. because i added jre 8 in my android studio compile path.so its required both in same version to aviod conflict.
3.) so once its installed, just restart your android studio and run device moniter from android studio.now you android studio will able to launch device moniter without any conflict.
Thank Happy coding :)
I had the same issue! Since I am not comfortable with using terminal, I just tried updating to the latest Java JDK and it seemed to fix the problem

Cordova and setting Android using command line

I am trying to migrate my existing project from cordova 2.1 to the latest, 3.1 which can be installev vía command line,
I already have the Android SDK installed,
So:
sudo npm install -g cordova // All good
cordova create hello com.example.hello HelloWorld // All good
cordova platform add android // Then it fires:
Checking Android requirements...
[Error: The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: ]
So I installed Macports and tried:
sudo port install android
Which logs:
Warning: All compilers are either blacklisted or unavailable; defaulting to first fallback option
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
---> Cleaning android
---> Scanning binaries for linking errors: 100.0%
---> No broken files found.
Any idea what am I missing here?
It's work cordova Android for MAC 1000000000%. I fought solution and now i'm working try this #Toni Michel Caubet. I will happy to share my Answer.
STEPS:
Open Your Terminal and followed by,
touch ~/.bash_profile
open ~/.bash_profile
PATH="/Users/System-Name/Documents/android-sdk-macosx/sdk/tools:/Development/android-sdk-macosx/sdk/platform-tools:$PATH" (This is Android SDK Location to stored in My system )
4.Save the file and quit the text editor.
5.Execute your .bash_profile to update your PATH:
source ~/.bash_profile
if you want to see your environment path:
7.In your terminal type: set
After you can see like
8.As far as your made it very correct. After your enter command like cordova platform add android. you get following error. because Java SDK doesn't too set environment PATH.
9.open ~/.bash_profile. Add JAVA_HOME value
10.You can see your environment like STEP 7 set. You should be able see:
11.Successfully created environment now you can create Android project with Cordova or PhoneGap
When you installed the Android SDK, it will come with a bunch of folders, like build-tools, platform-tools, tools, and some others. You need to add platform-tools and tools to your main $PATH environment variable.
See the docs here about how to add things to your PATH for whichever system you are on (Windows or Mac): http://cordova.apache.org/docs/en/3.1.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide
Here is how you would edit the $PATH on Windows:
Click on the Start menu in the lower-left corner of the desktop,
right-click on Computer, then click Properties.
Click Advanced System Settings in the column on the left.
In the resulting dialog box, press Environment Variables.
Select the PATH variable and press Edit.
Append the following to the PATH based on where you installed the
SDK, for example: ;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools
Save and close both dialogs.
To install the cordova command-line tool, follow these steps:
First of all go through the Cordova Document
For Cordova command-line tools to work, you need to include the SDK's tools and platform-tools directories in your PATH environment. On Mac, you can use a text editor to create or modify the ~/.bash_profile file, adding a line such as the following, depending on where the SDK installs:
export PATH=${PATH}:/Development/adt-bundle/sdk/platform-tools:/Development/adt-bundle/sdk/tools
Next Steps:
Download and install Node.js from Here. Following installation, you should be able to invoke node or npm on your command line.
Install the cordova utility. In Unix(Mac), prefixing the additional sudo command may be necessary to install development utilities in otherwise restricted directories:
For Mac $ sudo npm install -g cordova
once successful installation of cordova is done ,now you can create your application
across all the platforms.
Create the Cordova Application
Go to the directory where you maintain your source code, and run a command such as the following:
$cordova create hello com.example.hello CordovaDemo
hello is the directory where you want to create your application
com.example.hello is the package name
CordovaDemo is the name of the Application
Once Successful creation of your project, some file will be created inside the directory i.e hello
Add Platforms
All subsequent commands need to be run within the project's directory, or any subdirectories within its scope:
$ cd hello
Now you need to specify a set of target platforms, Supported OS for Mac
$ cordova platform add android
plz tell me if you are still having problem.
[Error: The command `android` failed. Make sure you have the latest Android SDK installed, and the `android` command (inside the tools/ folder) added to your path. Output: ]
You just need to install the Latest version of Android i.e 4.3
Go to SDK Manager and install the latest SDK Platform.
And try run the command again.
Hope this will help you.
Here it solved my issue:
into the terminal.
touch ~/.bash_profile (create a bash profile)
open ~/.bash_profile (opening a bash profile)
in your opened file, please type the following, Make sure that you have given the correct path, in case you find it difficult to find your directory in which your Android SDK is installed , search into your terminal with ls -l.
PATH="/Users/System-Name/Documents/android-sdk-macosx/sdk/tools:/Development/android-sdk-macosx/sdk/platform-tools:$PATH"
[Let me clarify first that, this is windows specific suggestion, answer]
For particular cordova version there corresponds particular android API
So,
First check out version of cordova with following command:
$ npm cordova -v
In my case cordova version was 1.4.28 , which corresponds to Android API 19
So the bottom line is don't waste time in downloading all "SDK Platforms"
instead just download corresponding Android API for concerned cordova version...
Hope this help....!!!

Categories

Resources