Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encountered internal error running command: Error: targetSdkVersionFromManifest failed. Original error: Cannot read property '1' of null #7353

Closed
jhwing opened this issue Dec 3, 2016 · 49 comments
Labels
Android related to Android-native driver(s) Bug a problem that needs fixing

Comments

@jhwing
Copy link

jhwing commented Dec 3, 2016

when i run sample-code android_simple.py i got this error ,i search everywhere ,no result

[debug] [AndroidDriver] Shutting down Android driver
[debug] [AndroidDriver] Called deleteSession but bootstrap wasn't active
[debug] [ADB] Getting connected devices...
[debug] [ADB] 1 device(s) connected
[debug] [ADB] Running '/Users/jihongwen/Development/android/android-sdk-macosx/platform-tools/adb' with args: ["-P",5037,"-s","760ABLMW96TX","shell","am","force-stop","io.appium.unlock"]
[debug] [Logcat] Stopping logcat capture
[debug] [AndroidDriver] Not cleaning generated files. Add clearSystemFiles capability if wanted.
[MJSONWP] Encountered internal error running command: Error: targetSdkVersionFromManifest failed. Original error: Cannot read property '1' of null
at Object.wrappedLogger.errorAndThrow (lib/logger.js:60:13)
at ADB.callee$0$0$ (../../../lib/tools/android-manifest.js:101:9)
at tryCatch (/Users/jihongwen/.nvm/versions/node/v7.2.0/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/jihongwen/.nvm/versions/node/v7.2.0/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/jihongwen/.nvm/versions/node/v7.2.0/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Users/jihongwen/.nvm/versions/node/v7.2.0/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at process._tickCallback (internal/process/next_tick.js:103:7)
[HTTP] <-- POST /wd/hub/session 500 1585 ms

@triager triager added the Needs Triage bugs which are not yet confirmed label Dec 3, 2016
@joodies
Copy link

joodies commented Dec 3, 2016

same issue here withe appium 1.6.2, on windows 7.

same error with appium 1.6.1 on windows 7.

test with latest chrome on android.

@sankleta
Copy link

sankleta commented Dec 3, 2016

#7349 The same here

@sravanmedarapu
Copy link
Member

Seems something broken with appium-adb v2.9.0, Please downgrade appium-adb to v2.7.0 as a temporary work around.

@chanisasuw
Copy link

same me via window 7
I installed appium version 1.6.2

@sravanmedarapu
Copy link
Member

@chanisasuw, I am working on this issue. As a temporary workaround, please downgrade appium-adb to 2.7.0.

npm install appium-adb@2.7.0

@mykola-mokhnach
Copy link
Collaborator

It is also possible to avoid the issue for now by explicitly setting the android:targetSdkVersion property in the manifest file (https://developer.android.com/guide/topics/manifest/uses-sdk-element.html). It seems like the actual implementation does not respect the fact, that this property can be omitted (and it is equal to android:minSdkVersion in such case).

@jlipps FYI

@chanisasuw
Copy link

chanisasuw commented Dec 3, 2016

@sravanmedarapu Thank you so much for working this issue, It didn't work for me.

Now i cannot do anything about test

@joodies
Copy link

joodies commented Dec 5, 2016

tried
npm install -g appium-adb@2.7.0

finally it's working now..

@jeangb
Copy link

jeangb commented Dec 5, 2016

Hi, this workaround "npm install appium-adb@2.7.0" didn't change a thing neither.

@devin-joubran-moovel
Copy link

Hi,

I'm also experiencing this issue on a mac 10.11.6, android nexus 5 api 23; appium 1.6.2. Tried appium-adb 2.7.0 and no changes

@Rdexmah
Copy link

Rdexmah commented Dec 5, 2016

Hey I am also facing same issue with ios10.0.1 and with latest appium 1.6.2 beta..
You got any resolution >

@cavanpage
Copy link

npm install appium-adb@2.7.0 worked for me.

I am pretty new to node so I wasn't installing it into the right place at first.
Make sure you execute that command within the appium directory (for windows the default location for me is C:\Users\myusername\AppData\Roaming\npm\node_modules\appium" )

I am running appium@1.6.0 on windows 7, testing a Samsung S6 with the newest chrome app.

I also had to replace the "appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe" with the latest driver from here https://sites.google.com/a/chromium.org/chromedriver/ . This stopped the "NoSuchSession" error.

My tests are running great now.

@lilfry14
Copy link

lilfry14 commented Dec 6, 2016

I was having this issue with appium 1.6 on a Mac 10.11.6 and npm install appium-adb@2.7.0 worked for me.

@viveksinghtt
Copy link

viveksinghtt commented Dec 6, 2016

i have this issue as well...on mac...npm install -g appium-adb@2.7.0 didnt work.... @sravanmedarapu can you please provide a hotfix for this?
On mAc u need to naviagte to folder where appium is installed and then run this command.Then it works fine as @sravanmedarapu said

@sravanmedarapu
Copy link
Member

@viveksinghtt, Can you please execute nm install appium-adb@2.7.0 from appium installed repo.

@jeangb
Copy link

jeangb commented Dec 6, 2016

Apart downgrading to appium-adb@2.7.0, if it doesn't work, is there an other workaround while waiting the hotfixe ?

@sravanmedarapu
Copy link
Member

sravanmedarapu commented Dec 6, 2016

@jeangb, I am working on this issue. Will update here once issue is fixed.

Downgrading to appium-ad@2.7.0 should work as the issue reported introduced in v2.9.0.

@jeangb
Copy link

jeangb commented Dec 6, 2016

@sravanmedarapu, Thank you very much for your quick feedback.

@z00sts
Copy link

z00sts commented Dec 6, 2016

Same.
Ubuntu 14.04x64, appium 1.6.1
Downgrading to appium-adb@2.7.0 helps.
Any ideas why appium-adb 2.8+ is not working with appium@1.6+?

@vikramvi
Copy link
Contributor

vikramvi commented Dec 6, 2016

@vikramvi
Copy link
Contributor

vikramvi commented Dec 6, 2016

@jlipps can we please have a hot fix release for this

@saikrishna321
Copy link
Member

@vikramvi this issue has been picked by @sravanmedarapu and he is working on it ..

@vikramvi
Copy link
Contributor

vikramvi commented Dec 6, 2016

Workaround for now as below

Goto directory /usr/local/lib/node_modules/appium
and run below command
npm install appium-adb@2.7.0

After this npm -g ls , shows updated appium-adb@2.7.0 from appium-adb@2.9.0

@steveyoungqa
Copy link

I can confirm that after struggling with this issue all weekend installing on the latest Macbook Pro that the above workaround works perfect!

@upadhyaynidhi
Copy link

upadhyaynidhi commented Dec 6, 2016

@vikramvi ran appium and
Getting such errors after Goto directory /usr/local/lib/node_modules/appium
and run below command
npm install appium-adb@2.7.0

Error: Cannot find module 'babel-runtime/helpers/sliced-to-array'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/appium/build/lib/main.js:7:22)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Function.Module.runMain (module.js:457:10)

@chenyu-wang
Copy link

Same issue happened for me, I downgraded appium to 1.6.1 it works again.
Have any one tried the 1.6.3 version of appium, just want to check if it is fixed or not

@sravanmedarapu
Copy link
Member

@chenyu22 Issue is fixed in apapium-adb@2.9.1

@jibingli
Copy link

jibingli commented Dec 7, 2016

No compatible version found: appium@1.6.3, build failed?

@sravanmedarapu
Copy link
Member

appium@1.6.3 is not released yet.

@cnpallares
Copy link

+1 @vikramvi solution!

@davidrova
Copy link

I have the same issue with appium 1.6.2.

I have tried with appium-adb from 1.6.19 to latest with no sucess.

Any workaround? It is blocker.

Would the workaround be change manifest from android project?

I have several manifest files with the targetSdkVersion parameter, so I don't know where appium-adb is looking for this parameter. Which file path is opening?

@sravanmedarapu
Copy link
Member

@davidrova, Issue is fixed in appium-adb@v2.9.1.

@davidrova
Copy link

Hi @sravanmedarapu,

I have checked that version. The exception still is thrown but it is true the application starts.

I still don't know which AndroidManifest.xml is appium-adb looking for because in our proyect it exists.

What we have checked is that in the apk it is cypher, but adb should decode it, isn't it?

If you need more info, let me know.

Regards,

PD. For the stakeholders: remember to restart appium after upgrade appium-adb.

@sravanmedarapu
Copy link
Member

@davidrova, This implementation is as part of granting permissions to the AUT. but for granting the permissions we are relaying on device API (API >= 23) and targetSdkVersion from the AUT (targetSdkVersion >= 23).

We are relying on aapt dump badging APK command's result for fetching the targetSdkVersion. if the targetSdkVersion < 23, we are just skipping the permissions granting.

But there are cases where we don't find targetSdkVersion in the dump result and in such case we are throwing the exception and ignoring the execution to continue with.

@vlaquest
Copy link

vlaquest commented Dec 8, 2016

Hi,
using 1.6.2 on windows. Just upgraded appium-adb to 2.9.1 but I still have the error.
Encountered internal error running command: Error: targetSdkVersionFromManifest failed. Original error: Cannot read property '1' of null
And I get an internal error (http 500) so my test is failing, appium stops processing.
Just checked adb version : Android Debug Bridge version 1.0.36
Revision 302830efc153-android
This is blocking me :(

@sravanmedarapu
Copy link
Member

@vincentlabatut, seems updating appium-adb to 2.9.1 was not successful. Can you please cross check(version in appium\node-modules\appium-adb\package.json).

Just to conform error message you have shared is related to 2.9.0, error message is changed in 2.9.1.

execute npm install appium-adb@2.9.1 from appium repo.

@nrazvan87
Copy link

I've tried all solutions presented above but didn't work for me :(
I've installed then npm install appium-adb@1.6.0 and everything started to work smoothly.

Thanks for the tips, It was a good starting point!

@vlaquest
Copy link

vlaquest commented Dec 8, 2016

Thanks ! Just did that : workaround for 1.6.2 is reverting to 1.6.0
it works again :)

@sravanmedarapu
Copy link
Member

Issue is fixed in appium-adb v2.9.1

@vlaquest
Copy link

vlaquest commented Dec 9, 2016

Hi, I was just saying that I installed appium-adb to 2.9.1 and the issue was still there...

@jeangb
Copy link

jeangb commented Dec 9, 2016

Yes me to, I guess the appium-adb 2.9.1 install didn't work.

@vlaquest
Copy link

vlaquest commented Dec 9, 2016

Got it! My fault. I did not install appium-adb correctly because we need to upgrade the appium-adb module that is inside the node_modules of the node_modules/appium folder.
so just saying npm install appium-adb@2.9.1 is not sufficient. You have to do that from the node_modules\appium folder in order to upgrade the appium-adb that is where appium will find it.
We are not all nodejs expert (at least I am not), but now it looks obvious to me.

Result is that it is working :)

The error is displayed
[ADB] Error: fetching targetSdkVersion from local APK failed. Original error: targetSdkVersion is not specified in the application.
(with the full stack trace)
[ADB] Ran into problem getting target SDK version; ignoring...

And all is working...

@z00sts
Copy link

z00sts commented Dec 9, 2016

@vincentlabatut Yep, nodejs local installation always confusing. @jeangb check that you upgrading appium-adb in your appium/node_modules

@jlipps jlipps added this to the Optimus Prime [Sprint 3] milestone Dec 9, 2016
@jlipps jlipps added Android related to Android-native driver(s) Bug a problem that needs fixing and removed Needs Triage bugs which are not yet confirmed labels Dec 9, 2016
@jeangb
Copy link

jeangb commented Dec 12, 2016

Yes it was because I was doing "npm install appium-adb@2.9.1" from $home...
I thought it will be installed in the right folder since the first time I installed appium with npm, it was installed in a custom folder and not in $home.
So yes, it's working with appium-adb 2.9.1, thanks.

@srkannan
Copy link

I did npm install -g appium-adb@2.9.1 in /usr/local/lib/node_modules/appium
But I still have the issue. I'm using Appium version 1.6.2

@saikrishna321
Copy link
Member

@srkannan please upgrade appium version to 1.6.3 , thats got the fix

@srkannan
Copy link

Upgrading to appium version 1.6.3 helped, Thanks.

@hiran47
Copy link

hiran47 commented Feb 2, 2017

Goto directory /usr/local/lib/node_modules/appium
and run below command
npm install appium-adb@2.7.0

This has worked for me as well.
OS X 10.12.3
Appium 1.6.2

@lock
Copy link

lock bot commented Apr 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android related to Android-native driver(s) Bug a problem that needs fixing
Projects
None yet
Development

No branches or pull requests