I have follwed every step to install amplify and created IAM user successfully.
I am getting this error when I am typing amplify init in android studio terminal
amplify : The term 'amplify' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.
At line:1 char:1
+ amplify configure
+ ~~~~~~~
+ CategoryInfo : ObjectNotFound: (amplify:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Related
this is the error that I get when I enter run flutter in the command line
+ CategoryInfo : ObjectNotFound: (run:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Any ideas how can I fix it?
I deleted and reinstalled android still thinking that it was a problem with the version I'm using but it still not working
From the error message, it looks like you are using a Windows system. Make sure you have downloaded flutter and added its bin folder to the Path variable.
This can be done as follows:
Press the start button and type env
Open "Edit environment variables for your account"
Look for an entry called Path. If it does not exist, click "New..." to create it.
Click on the Path item and the path to your flutter/bin folder C:\<your_path>\flutter\bin
i'm trying to install flutter on my windows and when i type flutter doctor on cmd i get error then it exit the cmd with no error message , and i try to write flutter doctor on git batch i get this error message
Checking Dart SDK version...
The term 'Unblock-File' is not recognized as the name of a cmdlet, function, sc
ript file, or operable program. Check the spelling of the name, or if a path wa
s included, verify that the path is correct and try again.
At line:1 char:13
+ Unblock-File <<<< -Path 'C:\flutter/bin/internal/update_dart_sdk.ps1'; & 'C:
\flutter/bin/internal/update_dart_sdk.ps1'; exit $LASTEXITCODE;
+ CategoryInfo : ObjectNotFound: (Unblock-File:String) [], Comman
dNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Flutter requires PowerShell 5.0 or newer.
See https://flutter.dev/docs/get-started/install/windows for more.
Current version is 2.
i have made variable name path with this value
C:\Windows\System32;C:\Program Files\Git\git-
cmd.exe;C:\flutter\bin;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program
Files\Git\bin\git.exe;C:\Program Files\Git\cmd
You will need to install Powershell 5.0. I also recommend you to check the system requirements page for installing flutter.
In the old eclipse IDE there was an option to install sqlite browser and view the database in the ide itself without downloading and saving it to our system.
In the new android studio there is an option call device explorer where you can go to data/data//databases/yourdb.db
but when you click on it you will be provided with open, save as, delete, synchronize and copypath
when i click on open
but couldn't find anything to load the db in that options. I scrolled to end i checked.
Please help me in finding out what app from that selection should i use to view the db if it have any.
Or can i install some plugins to android studio and view the db directly from devive explorer
One more question is there is no Tools/Android section in new Android studio to view android device monitor where can i find android device monitor in new android studio
Please help
In AS 3.1.2 there is option to right side as 'Device File Explorer' click on it then select data\data\'package name'\database\ here you will get your database file. Save it on any drive location. To view content install 'DB Browser for SQLite' there is option open database
As of now there is no option to open db in Android Studio however you can try these options :
Android debug database : Small library developed by AmitShekhar
which will allow you to see database on your browser.
DB browser for SQLite : Desktop app for opening DB files.
I believe you are trying to open db in Android studio itself just to save time, if this is the case you can use this Python script to copy db into your local machine and then open in SQLite DB browser.
import sys
import subprocess
import re
#/
# Created by #nieldeokar on 25/05/2018.
#/
# 1. Python script which will copy database file of debuggable apps from the android device to your computer using ADB.
# 2. This script ask for PackageName and DatabaseName at runtime.
# 3. You can make it static by passing -d at as command line argument while running script and setting defaults in following way.
# 4. Edit script and change the values of varialbe packageName and dbName to debuggable app package name and database name then
# run script as : python Copydbfileandroid.py -d
useDefaults = False
def checkIfPackageInstalled(strSelectedDevice) :
packageName = 'com.nileshdeokar.healthapp.debug'
dbName = 'healthapp.db'
if not useDefaults :
print('Please enter package name : ')
packageName = raw_input()
packageString = 'package:'+packageName
try:
adbCheckIfPackageInstalledOutput = subprocess.check_output('adb -s ' + strSelectedDevice + ' shell pm list packages | grep -x '+ packageString, shell=True)
except subprocess.CalledProcessError as e:
print "Package not found"
return
if packageString.strip() == adbCheckIfPackageInstalledOutput.strip() :
if not useDefaults :
print('Please enter db name : ')
dbName = raw_input()
adbCopyDbString = 'adb -s '+strSelectedDevice + ' -d shell \"run-as '+packageName+' cat /data/data/'+packageName+'/databases/'+ dbName +'\" > '+dbName
try:
copyDbOp = subprocess.check_output(adbCopyDbString,shell=True)
except subprocess.CalledProcessError as e:
return
if "is not debuggable" in copyDbOp :
print packageString + 'is nto debuggable'
if copyDbOp.strip() == "":
print 'Successfully copied '+dbName + ' in current directory'
else :
print 'Package is not installed on the device'
defaultString = "-d"
if len(sys.argv[1:]) > 0 and sys.argv[1] == defaultString :
useDefaults = True
listDevicesOutput = subprocess.check_output("adb devices", shell=True)
listDevicesOutput = listDevicesOutput.replace("List of devices attached"," ").replace("\n","").replace("\t","").replace("\n\n","")
numberofDevices = len(re.findall(r'device+', listDevicesOutput))
connectedDevicesArray = listDevicesOutput.split("device")
del connectedDevicesArray[-1]
strSelectedDevice = ''
if(numberofDevices > 1) :
print('Please select the device : \n'),
for idx, device in enumerate(connectedDevicesArray):
print idx+1,device
selectedDevice = raw_input()
if selectedDevice.isdigit() :
intSelected = int(selectedDevice)
if 1 <= intSelected <= len(connectedDevicesArray) :
print 'Selected device is : ',connectedDevicesArray[intSelected-1]
checkIfPackageInstalled(connectedDevicesArray[intSelected-1])
else :
print 'Please select in range'
else :
print 'Not valid input'
elif numberofDevices == 1 :
checkIfPackageInstalled(connectedDevicesArray[0])
elif numberofDevices == 0 :
print("No device is attached")
Execution :
Set default variables like packageName & dbName in script and then
python Copydbfileandroid.py -d
I'm working on Ionic project now whereby I want to zipalign the android-release-unsigned.apk file. I followed this guide by Ionic.
When I run zipalign -v 4 /Users/zulhilmizainudin/Desktop/kl-parking/platforms/android/build/outputs/apk/android-release-unsigned.apk android-release.apk command, I get -bash: zipalign: command not found error.
This is where zipalign sit in my system:
/Users/zulhilmizainudin/Library/Android/sdk/build-tools/21.1.2
I tried to copy zipalign inside it and put it inside my Ionic project folder and run the zipalign command again. But still get the same command not found.
What should I do now?
Solved!
I copied zipalign file from my Library/Android/sdk/build-tools/21.1.2 into my Ionic project folder
I add ./ in front of the zipalign command like this - ./zipalign -v 4 /Users/zulhilmizainudin/Desktop/kl-parking/platforms/android/build/outputs/apk/android-release-unsigned.apk android-release.apk
Done. Now I get android-release.apk inside my Ionic project folder.
Thanks to Michael for the solution!
If you're using Windows, the right way is to add path to zipalign.exe as PATH environment variable.
Finding where zipalign.exe is located in your PC, in my case this was
C:\Users\random-username\AppData\Local\Android\sdk1\build-tools\24.0.1
Then add this location as one of the entries in your PATH environment variable.
To avoid specifying or navigating to your sdk/build-tools/* directories each time you intend to build release version, you can simply add the path to your environment variable.
$ sudo nano ~/.bash_profile
copy and paste the below:
export PATH=${PATH}:/Library/Android/sdk/build-tools/21.1.2
You can then save and exit:
control + o // to save to file
control + x // to close the file
$ source ~/.bash_profile
You can then run your zipalign command from your project CLI directory.
This worked for me on Mac. Install and run Android Studio (important to start it one time).
Then find zipalign:
find ~/Library/Android/sdk/build-tools -name "zipalign"
Windows
the right way is to add path to zipalign.exe as PATH environment variable.
Finding where zipalign.exe is located in your PC, in my case this was
C:\Users\username\AppData\Local\Android\sdk1\build-tools\29.0.2
Then add this location as one of the entries in your PATH environment variable.
MAC
To avoid specifying or navigating to your SDK/build-tools/* directories each time you intend to build a release version, you can simply add the path to your environment variable.
$ sudo nano ~/.bash_profile
copy and paste the below:
export PATH=${PATH}:/Library/Android/sdk/build-tools/21.1.2
You can then save and exit:
control + o // to save to file
control + x // to close the file
$ source ~/.bash_profile
You can then run your zipalign command from your project CLI directory.
if you are making ionic release build then you can make build.json file on your app's root folder with these information given below
{
"android": {
"release": {
"keystore": "Your keystore",
"storePassword": "password",
"alias": "alias name",
"password" : "password",
"keystoreType": ""
}
} }
make sure that you can place your keystore on your app's root folder or provide full path of your keystore at keystore object
now just you can run this command as below
ionic cordova build android --release
this command automatically find your build.json and make signed release build.
Solved!
I copied zipalign file as Michael Said
( from my Library/Android/SDK/build-tools/28.0.3 into my Ionic project folder)
BUT when I run
./zipalign -v 4 app-release-unsigned.apk botellamovil.apk
I got
./zipalign: ERROR while loading shared libraries: libc++.so: cannot open shared object file: **No such file or directory**
So, I also copied lib & lib64 files, and then it Works!!
I hope it will be helpful :) (and sorry for my English)
You should do (align, sign, and verify)for APK.
In mac, you should do the following steps:
A - Aligning APK:
1- you should locate zipalign your build tools inside android SDK:
/Users/mina/Downloads/sdk/build-tools/29.0.3/zipalign
2- you should locate your unsigned apk:
/Users/mina/Desktop/apks/app_unsigned.apk
3- you should run command contains:
zipalign_path + -v -p 4 + unsigned_apk_path + output_aligned_apk_name
/Users/mina/Downloads/sdk/build-tools/29.0.3/zipalign -v -p 4
/Users/mina/Desktop/apks/app-unsigned.apk app_aligned.apk
4- output is Verification successful
B - Signing APK:
1- you should locate apksigner your build tools inside android SDK:
/Users/mina/Downloads/sdk/build-tools/29.0.3/apksigner
2- you should locate your release-Keystore in your pc:
/Users/mina/Desktop/keys/release-Keystore.jks
3- you should run command contains:
apksigner_path + sign --ks + release-Keystore_path + --out + output_signed_apk_name + from_aligned_apk_name
/Users/mina/Downloads/sdk/build-tools/29.0.3/apksigner sign --ks
/Users/mina/Desktop/keys/release-keystore.jks
--out app_signed.apk app_aligned.apk
4- enter your key store password
C- Verifying APK:
1- run the following command : apksigner_path + verify + app_signed.apk
/Users/mina/Downloads/sdk/build-tools/29.0.3/apksigner verify
app_signed.apk
Notes: you may find some warnings:
WARNING: META-INF/....
Here is some description about that:
Apk Metainfo Warning
In practice, these files are not important, they're mostly versions of libraries you depend on, so even if someone modified those, it wouldn't have any impact on your app. That's why it's only a warning: those files in your APK can be modified by someone else while still pretending that the APK is signed by you, but those files don't really matter.
D- find your signed APK:
/Users/mina/app_signed.apk
I solved this problem by making the zipalign path an environment variable:
export ZIPALIGN_PATH=~/Library/Android/sdk/build-tools/30.0.3/zipalign
Then I replaced zipalign with $ZIPALIGN_PATH in the script I was trying to run
I'm running into several problems since I installed Kali from the USB live installer.
I found out that I needed to add this into my sources.list file in /etc/apt folder.
Just replace the content of sources.list with:
deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free
deb http://old.kali.org/kali sana main non-free contrib
deb http://ftp.de.debian.org/debian wheezy main
I am trying to setup a basic "hello world" PhoneGap project. I've been walking through the steps found at http://docs.phonegap.com/en/2.7.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android. I am doing this on a Windows 7 Ultimate machine.
I have successfully setup Java and Ant. I have confirmed this by typing "javac -version" in a command prompt (1.6.0_39 is shown). When I type "ant" in a command prompt, I receive a message that says "Buildfile: build.xml does not exist! Build failed". At this point, I'm confident I've done everything properly through step 3. However, when I get to step 4, I run into issues.
On step 4 when I type "create C:\Tests\Android Test MyNamespace.Test.Android" in a command prompt, I receive an error that says: "create is not recognized as an internal or external command, operable program or batch file.". What could be wrong? Where does "create" come from? I'm in the /Cordova/phonegap-2.7.0/phonegap-2.7.0/lib/android directory when I run the command, I receive the following error:
Creating new android project...
Copying template files...
Copying js, jar & config.xml files...
Copying cordova command tools...
Updating AndroidManifest.xml and Main Activity...
C:\Program Files\Cordova\phonegap-2.7.0\phonegap-2.7.0\lib\android\bin\create.js
(31, 5) Microsoft JScript runtime error: Path not found
I can see the create.js file. However, for some reason I'm getting this "Path not found" error. Did I enter an incorrect command prompt parameter? I keep staring at it and everything looks correct.
Thank you!
Same problem here...
Strangely if I run the comand "Create" with no parameters, it creates a folder "example" with a sample app, without the error
I found the answer in: https://groups.google.com/d/msg/phonegap/tnz2DnUE-E0/ADZibhwHGpYJ
The problem is with this line in "create.js":
var ACTIVITY_PATH=PROJECT_PATH+'\\src\\'+PACKAGE_AS_PATH+'\\'+ACTIVITY+'.java';
[...]
exec('%comspec% /c copy "'+ROOT+'"\\bin\\templates\\project\\Activity.java '+ ACTIVITY_PATH +' /Y');
The Windows "copy" command will not create directories that don't exist, so the command above fails because "src\PACKAGE_AS_PATH" doesn't exist. This can be fixed with:
var ACTIVITY_DIR=PROJECT_PATH + '\\src\\' + PACKAGE_AS_PATH;
var ACTIVITY_PATH=ACTIVITY_DIR+'\\'+ACTIVITY+'.java';
[...]
exec('%comspec% /c mkdir ' + ACTIVITY_DIR);
exec('%comspec% /c copy "' + ROOT + '"\\bin\\templates\\project\\Activity.java ' + ACTIVITY_PATH + ' /Y');
Check your environment path:
Set Environment variables:
Path:
Start -> Control Panel -> System and Security -> System -> Environment variables
Or
Mycomputer -> Right Click -> properties -> Advance System settings -> Environment variables
1. Java JDK
2. Android SDK
3. ANT
User variables for user1:
Path: %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Users\user1\AppData\Roaming\npm\
Temp:
%USERPROFILE%\AppData\Local\Temp
System variables:
ANDROID_HOME: C:\Nithi\software\Android_sdk\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk\
Path:
ANT_HOME: C:\ant
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_45\
JAVA_PATH: C:\Program Files (x86)\Java\jre7\bin
Path: c:\Program Files (x86)\Intel\iCLS Client\;c:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\nodejs\;%ANT_HOME%\bin;%JAVA_HOME%\bin;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
is your Environment variables set for JAVA and ANT? Also, can you share the create command you are using? There should be no spaces in package names.
You should be in Cordova/phonegap-2.7.0/phonegap-2.7.0/lib/android/bin directory. Then type:
create {path} {project.with.dots} {YourProjectName}.
For example, I just ran:
C:\server\cordova\phonegap-2.7.0\phonegap-2.7.0\lib\android\bin> create ../MyTest my.test.com MyTestProject and it created MyTest folder in C:\server\cordova\phonegap-2.7.0\phonegap-2.7.0\lib\android\.
Also, if you do echo %PATH%, you should see the directories to your ant\bin, android-sdk\tools, android-sdk\platform0tools, and %JAVA_HOME%.
I think you should put your path to the project directory in "" otherwise the create script will interpret "Test" as the package name, which is obviously not a valid package name.
So command should read:
create "C:\Tests\Android Test" MyNamespace.Test.Android AndroidTest
It looks like the project name cannot have dots in it.
C:\Phonegap\android\bin>create c:\android\helloworld3 com.hello.world helloworld
Microsoft (R) Windows Script Host Version 5.8 Copyright (C) Microsoft
Corporation. All rights reserved.
C:\Phonegap\android\VERSION Creating new android project... Copying
template files... Copying js, jar & config.xml files... Copying
cordova command tools... Updating AndroidManifest.xml and Main
Activity... c:\android\helloworld3\src\com\hello\world\helloworld.java
c:\android\helloworld3\src\com\hello\world\helloworld.java
c:\android\helloworld3\AndroidManifest.xml
c:\android\helloworld3\AndroidManifest.xml
c:\android\helloworld3\AndroidManifest.xml
(works ok)
But...
C:\Phonegap\android\bin>create c:\android\helloworld4 com.hello.world hello.world
Microsoft (R) Windows Script Host Version 5.8 Copyright
(C) Microsoft Corporation. All rights reserved.
C:\Phonegap\android\VERSION Creating new android project... Copying
template files... Copying js, jar & config.xml files... Copying
cordova command tools... Updating AndroidManifest.xml and Main
Activity...
c:\android\helloworld4\src\com\hello\world\hello.world.java
C:\Phonegap\android\bin\create.js(32, 5) Microsoft JScript runtime
error: Path not found
(fails)
Unhelpful error message though.