I am trying to use Apache Cordova for Android apps.
I had installed it with npm, but when I type the command cordova platforms add android, I have this error:
npm http GET https://registry.npmjs.org/cordova-android/4.0.0
TypeError: Request path contains unescaped characters.
at new ClientRequest (_http_client.js:73:11)
at TunnelingAgent.exports.request (http.js:49:10)
at TunnelingAgent.createSocket (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:117:25)
at TunnelingAgent.createSecureSocket [as createSocket] (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:184:41)
at TunnelingAgent.addRequest (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_modules\tunnel-agent\index.js:80:8)
at new ClientRequest (_http_client.js:154:16)
at Object.exports.request (http.js:49:10)
at Object.exports.request (https.js:136:15)
at Request.start (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:594:30)
at Request.end (C:\Users\Friend\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\index.js:1186:28)
I thought it was originating from the proxy, so I set http-proxy and https-proxy like this:
npm config set proxy h t t p://proxydomain:port/
And I set registry like this:
npm config set registry h t t p://registry.npmjs.org/
The error stays the same. I tried to delete the proxy from my network and from npm, but the error is still there.
How can I fix this?
I don't know if you fixed it yet.
But I had the same problem some days ago.
Just uninstall and reinstall node, I actually have with node -v version v0.12.2.
I had upgraded to nodejs 0.12.3 and started having this problem. I then researched and found a fix where I replaced certain files in the tunnel-agent folder. This fix worked but then I started having the same problem again after reinstalling Visual Studio 2013.
I removed node 0.12.3 and then installed 0.10.29 and now it is working again. I got the above error whenever I tried to install a windows platform. So now I am running the latest Cordova version with Node JS 0.10.29. I wonder if I would be able to use a more recent version of node or should I even bother.
From #geisi93 at ionic-cli github
for those who still have problems - propably you have to replace the
contents of
C:\Users{USERNAME}\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\request\node_modules\tunnel-agent
with the contents of with the content of this zip:
https://github.com/mikeal/tunnel-agent
too.
I have installed rhodes and android SDK and NDK
OS: Linux Mint 16 X64, Ruby: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux], SDK: Android.SDK.Release.v23.0.2.Linux, NDK: android-ndk32-r10-linux-x86_64 or android-ndk-r7b
and build.yml content:
#sdk: "/home/abolfazl/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rhodes-3.5.1.12"
sdkversion: 3.5.0
name: testapp
version: 1.0
vendor: rhomobile
build: debug
bbver: 4.6
applog: rholog.txt
iphone:
configuration: Release
sdk: iphonesimulator5.0
provisionprofile:
codesignidentity:
entitlements:
BundleIdentifier: com.rhomobile.testapp
BundleURLScheme: testapp
wp:
productid: '0ed4fa10-0f72-0132-4dc5-3870f4a0dbeb'
symbian:
uid: '0xee1f6bcc'
android:
version: 4.2.2
extensions: ["json", "another-extension"]
sdk manager:
when I run rake run:android:
cd
/home/abolfazl/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rhodes-3.5.1.12
$app_config['extensions'] : ["json", "another-extension"]
$app_config['capabilities'] : [] $vendor = rhomobile $app_package_name
= com.rhomobile.testapp rake aborted! Can't detect NDK toolchain path (corrupted NDK installation?)
Tasks: TOP => run:android => run:android:emulator =>
config:android:emulator => config:android (See full trace by running
task with --trace)
rhodes gem v3.5 was updated on github some times ago to adapt from changes in the newer NDKs (v3.5 was released around release 7 of the NDK).
Newer rhodes (latest is v5) directly supports the new NDKs.
Another thing is that rhodes still needs Ruby v1.9.3, seems that you're using it under Ruby v2.1.
You need to define path to Android NDK at <rhodes>/rhobuild.yml file. Or just run <rhodes>/bin/rhodes-setup
I am trying to use boost library with Android ndk in Eclipse with Windows. I tried to follow this tutorial
I am stuck in the step with "bjam" command in cygwin.
bjam --without-python --without-serialization toolset=gcc-android4.4.3 link=static runtime-link=static target-os=linux --stagedir=android
Error: bjam command not found.
What is bjam? Also I used the boost 1.53 along ndk r8e. Can someone help me with this please?
Android NDK is no longer dependent on Cygwin, so you can build Boost with the NDK from within Windows command prompt (cmd).
In order to make Boost.Build find the NDK, edit boost\tools\build\v2\user-config.jam file and append the following text:
import os ;
androidNDKRoot = C:/android-ndk-r8e ; # put the relevant path
using gcc : android :
$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-g++ :
<compileflags>--sysroot=$(androidNDKRoot)/platforms/android-9/arch-arm
<compileflags>-mthumb
<compileflags>-Os
<compileflags>-fno-strict-aliasing
<compileflags>-O2
<compileflags>-DNDEBUG
<compileflags>-g
<compileflags>-lstdc++
<compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/include
<compileflags>-I$(androidNDKRoot)/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi/include
<compileflags>-D__GLIBC__
<compileflags>-D_GLIBCXX__PTHREADS
<compileflags>-D__arm__
<compileflags>-D_REENTRANT
<archiver>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ar
<ranlib>$(androidNDKRoot)/toolchains/arm-linux-androideabi-4.7/prebuilt/windows/bin/arm-linux-androideabi-ranlib
;
Certainly, instead of c:/android-ndk-r8e you have to put the right location of the NDK on your PC.
Besides, you can select more recent platform API, instead of android-9.
Also note that the NDK supplies several tool-chains, and the above settings point to gcc-4.7. If you prefer to build boost with some other tool-chain, change arm-linux-androideabi-4.7 to the relevant path.
After you've put the configuration in user-config.jam, open cmd, cd to the directory where Boost resides, and invoke bootstrap. Then invoke b2 like this (for example):
b2 --without-python --without-serialization threading=multi link=static runtime-link=static toolset=gcc-android target-os=linux threadapi=pthread --stagedir=android stage
UPDATE: As of 11/2015, older NDK toolchains seem to have issues with the newer Boost versions, causing compiler crash, so consider using a more recent compiler. To do this, just change every 4.7 occurrence in the above script to 4.9. Also, it's worth compiling with a more recent Android API (eg. andoroid-9 -> andoroid-16 or so).
I am starting Android development in Ruby using Rhomobile framework. I am trying to run rake command for android
rake run:android
but I'm getting following error
ERROR!!! API version is not found in installed Android SDK: 2.1
any hint on how to solve it?
also my rhobuild.yml files looks like
env:
app: /Users/bhushan/rhodes_learn/employee_app
paths:
android-ndk: /Users/bhushan/android-ndk-r7
java: /Library/Java/Home/bin
android: /Users/bhushan/android-sdk-macosx
4.6:
jde:
sim: 9000
mds:
cabwiz:
4.2:
jde:
sim: 8100
mds:
excludedirs:
bb:
- public/js/iui
- public/js/jquery*
- public/jqtouch*
- public/js/prototype*
- public/css/iphone*
- public/iwebkit
- public/themes
- "**/jquery*.js"
- "**/*.db"
- public/images/android
- public/images/iphone
all:
- "**/.*.swo"
- "**/.*.swn"
- "**/.DS_Store"
android:
build:
symbianpath: platform/symbian
bb:
bbsignpwd: somepasswordhere
bbpath: platform/bb
wmpath: platform/wm
androidpath: platform/android
wppath: platform/wp7
iphonepath: platform/iphone
Is the actual Android SDK Platform 2.1 installed? You should be able to check it from the SDK Manager tool that came with the Android SDK.
Also, if you've recently updated Rhodes (to 3.3.1, for example) you may need to re-run rhodes-setup and set-rhodes-sdk to update the locations of the tools
HTH,
I had to change the specified Version number in Rhodes Config file.
Given an APK, is it possible to determine which version of Android platform it targets?
Use aapt:
aapt list -a package.apk | grep SdkVersion
You will see version numbers in hex. e.g.:
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x3
A: android:targetSdkVersion(0x01010270)=(type 0x10)0xc
For this apk, minSdkVersion is 0x3 i.e. 3, and targetSdkVersion is 0xc i.e. 12.
simply use aapt dump badging my_apk_file.apk to get a lot of info about your apk.
grep filter by Version
aapt dump badging my_apk_file.apk|grep Version
Output with $ANDROID_SDK_ROOT/build-tools/30.0.3/aapt:
package: name=... versionCode=... versionName=... compileSdkVersion='29' compileSdkVersionCodename='10'
sdkVersion:'11'
targetSdkVersion:'29'
The apk for any installed app $app (eg com.google.android.apps.docs) can be retrieved from your device with:
adb pull $(adb shell dumpsys package $app | grep path: | cut -c11-) $app.apk
Use apktool
java -jar apktool.jar d app.apk
Then look in the generated apktool.yml file for this:
sdkInfo:
minSdkVersion: '11'
targetSdkVersion: '17'
You can match the SDK version to Android version here. In the above example minimum Android version is 3.0 and target version is 4.2.
You can use apkanalyzer, it is is included in the Android SDK Tools, more infos here https://developer.android.com/studio/command-line/apkanalyzer
Prints the minimum SDK version.
apkanalyzer -h manifest min-sdk myapk.apk
Prints the target SDK version
apkanalyzer -h manifest target-sdk myapk.apk
You can extract the APK and look in the manifest file for the platform target.
like derek said above
use the apktool to decompile the apk and check the manifest version
platform versions can be found here
If you don't have grep, you can use
aapt list -a package.apk >file.txt
and search for minSdkVersion and targetSdkVersion in file.txt.
If you want to find these info from your mobile device you can install My APK app which gives you good information about apps
You can get it at https://play.google.com/store/apps/details?id=com.andatsoft.myapk.fwa&hl=en
The app which you want to have these information about, must either installed on your mobile device or you must have the app apk on your mobile.
The fastest way to get APK information is to use this online tool :
https://www.sisik.eu/apk-tool
In my case, I opened the apk file on Android Studio. So I can check the version of android at AndroidManifest.xml.
if you want it programmatically try use PackageManager class:
public PackageManager getPackageArchiveInfo(String archiveFilePath, int flags)
then read ApplicationInfo field and targetSdkVersion in it;
You can run following command to just get the API level (integer):
aapt dump badging "your_apk.apk" | awk '/targetSdkVersion/{gsub("targetSdkVersion:''|''",""); print $1}'
The output you'll get will be as below, in case it was compiled against KitKat (API 19):
19
PS: aapt is located in folder <Android-Sdk>/build-tools/<build-tools-version>/.
To find the platform targets for an APK file, use apktool.
Follow these instructions:
Use the GitHub repo to install it https://ibotpeaches.github.io/Apktool/.
After installing then run the following command -> apktool d file.apk
open the file folder.
locate the file named apktool.yml
the information is found in the SDK info:
Image 1, Image 2
If you are using Nautilus, you can add a column provider and a property page provider for APK files. This will provide lots of informations, including SdkVersion.
Steps are explained on this link : http://bernaerts.dyndns.org/linux/76-gnome/324-gnome-nautilus-apk-column-property-provider-extension
Cheers.
You can use http://www.javadecompilers.com/apk to decomplier file apk and you can find it in Mandifest
Another bush util function:
function android-target-sdk-version {
aapt list -a $1 | grep targetSdkVersion | grep -o '....$' | awk '{print $1+0}'
}