Appium 1.7.1 canot singin appium-uiautomator2-server-debug-androidTest.apk

Hi,

The Appium is crashing at signing the appium-uiautomator2-server-debug-androidTest.apk with error:

15:14:12 [debug] [ADB] App not signed with debug cert.
15:14:12 [debug] [ADB] Resigning apk.
15:14:12 [ADB] Error: Could not sign with default certificate. Original error spawn ENOTDIR
15:14:12 at Object.wrappedLogger.errorAndThrow (…/…/lib/logging.js:63:13)
15:14:12 at ADB.callee$0$0$ (…/…/…/lib/tools/apk-signing.js:25:9)
15:14:12 at tryCatch (/home/buildserver/node-v6.9.2-linux-armv7l/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
15:14:12 at GeneratorFunctionPrototype.invoke [as _invoke] (/home/buildserver/node-v6.9.2-linux-armv7l/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
15:14:12 at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/home/buildserver/node-v6.9.2-linux-armv7l/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
15:14:12 at GeneratorFunctionPrototype.invoke (/home/buildserver/node-v6.9.2-linux-armv7l/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
15:14:12 Error: Could not sign with default certificate. Original error spawn ENOTDIR
15:14:12 at Object.wrappedLogger.errorAndThrow (…/…/lib/logging.js:63:13)
15:14:12 at ADB.callee$0$0$ (…/…/…/lib/tools/apk-signing.js:25:9)
15:14:12 at tryCatch (/home/buildserver/node-v6.9.2-linux-armv7l/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
15:14:12 at GeneratorFunctionPrototype.invoke [as _invoke] (/home/buildserver/node-v6.9.2-linux-armv7l/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:315:22)
15:14:12 at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/home/buildserver/node-v6.9.2-linux-armv7l/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:100:21)
15:14:12 at GeneratorFunctionPrototype.invoke (/home/buildserver/node-v6.9.2-linux-armv7l/lib/node_modules/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)

additionally:

  • The appium was installed without sudo.
  • The manual apk singing seems to work fine with:
    java -jar ./node-v6.11.4-linux-armv7l/lib/node_modules/appium/node_modules/appium-espresso-driver/node_modules/appium-adb/jars/sign.jar ./node-v6.11.4-linux-armv7l/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/uiautomator2/appium-uiautomator2-server-v0.1.8.apk --overrride

version:
appium 1.7.1
node v6.11.4

Any help appreciated
Regards
Janusz

Can you try these two commands and check if it helps:
Mac

npm install appium-uiautomator2-driver
npm install appium-adb

Hi Mac
I’ve installed both appium-uiautomator2-driver and appium-adb, unfortunately same result as before.

The appium-uiautomator2-driver installation finished successfully just one warning:
npm WARN [email protected] requires a peer of request@^2.34 but none was installed.

and appium-adb installation successful with warning
npm WARN [email protected] requires a peer of request@^2.34 but none was installed.

additionally:

I’ve tried to sign the uiatomator2 with:
java -jar node-v6.11.4-linux-armv7l/lib/node_modules/appium/node_modules/appium-adb/jars/verify.jar ./node-v6.11.4-linux-armv7l/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/uiautomator2/appium-uiautomator2-server-v0.1.8.apk

get:

Exception in thread “main” java.lang.Exception: Invalid cert.
at v.Verify.verify(Verify.java:57)
at v.Verify.main(Verify.java:72)

Checked and it looks like the verification is based on MD5 as follows:
MD5: 1A:93:3C:20:FD:9D:DF:6E:89:07:C6:50:6D:E1:2A:5

and from what I can see, the sign and verify tools in appium have not been modified for 5 years.
How can I have the verification working here?

I’m getting appium with armv7l package:
https://nodejs.org/dist/v6.11.4/node-v6.11.4-linux-armv7l.tar.xz

Regards
Janusz

Eventually

  1. I’ve downloaded the x86 package where after signing the mentioned verify.jar was not complaining about invalid cert any longer.
  2. replaced the apk into the armv7l installation (target one)
  3. check if the verification is working - and it was (when signing with native tool is not)
  4. encounter the same issue … after the run…

For now I’ve made a hack and modified the
./node-v6.11.4-linux-armv7l/lib/node_modules/appium/node_modules/appium-adb/build/lib/tools/apk-signing.js
so it would return a true even if it looks not signed.
286
287 case 20:
288 context$1$0.prev = 20;
289 context$1$0.t0 = context$1$0’catch’;
290
291 _loggerJs2[‘default’].debug(“App not signed with debug cert.”);
292 return context$1$0.abrupt(‘return’, true);
293

It looks like a bug in https://nodejs.org/dist/v6.11.4/node-v6.11.4-linux-armv7l.tar.xz package during verifying and singing apks.

Could it be fixed please ? :slight_smile:

Regards
Janusz

2 Likes

Hi Janusz, glad that you resolved the issue. You can file a bug for this and wait for the team to fix it.