AWS Device Farm - Failed upload when using the CLI - android

I am trying to upload an apk to device farm using a bash script, I have used the create-upload endpoint to get a pre-signed url for the put request, and then I am using curl to PUT the apk to the end point.
RESPONSE=$(aws devicefarm create-upload --project-arn %deviceFarmProjectARN% --name platforms/android/build/outputs/apk/android-release-unsigned.apk --type ANDROID_APP --content-type application/octet-stream)
APK_ARN=$(echo "$RESPONSE" | grep arn:aws:devicefarm | gawk 'match($0, "(arn:aws:devicefarm(.*))\"", ary) {print ary[1]}')
APK_PUT_URL=$(echo "$RESPONSE" | gawk 'match($0, "\"url\": \"(.*)\"", ary) {print ary[1]}')
echo "$APK_ARN" >> apkARN.txt
curl $APK_PUT_URL -X PUT --upload-file platforms/android/build/outputs/apk/android-release-unsigned.apk -H "Content-Type:application/octet-stream"
The file upload seems to work, but when I check the status using the returned ARN the status is failed, and the reason is "Invalid application uploaded"
"upload": {
"status": "FAILED",
"contentType": "application/octet-stream",
"name": "platforms/android/build/outputs/apk/android-release-unsigned.apk",
"created": 1437582538.139,
"type": "ANDROID_APP",
"arn": "arn:aws:devicefarm:us-west-2:208791684493:upload:a9153182-8e03-4bc3-a5db-bc02034f1331/190ac7a5-bdc4-46f2-aac2-46bb994f2cf3",
"metadata": "{\"errorMessage\":\"Invalid application uploaded.\"}"
}
However when I upload exactly the same file through the GUI, on the web console, the application is fine, and I can run tests against it.

the upload name only accepts word characters. The upload is failing because of the forward slashes in the name.

Related

Delivering builds through slack with Circle CI not working in Android

I am configured "config.yml" file in Circle CI for Android, I need to deliver my APK to slack channel, all the things are configured as success, and build created successfully, but upload to slack does not work. Here is my config.yml code part for uploading
- run:
name: Upload to Slack
command: |
export GIT_COMMIT_DESC=$(git log --format=oneline -n 1 | sed -E 's/^[^ ]+
(.*)$/\1/g')
curl -F file=#app/build/outputs/apk/debug/empower_deposit-development.apk -F
channels=$SLACK_CHANNEL -F token=$SLACK_API_TOKEN -F title="${CIRCLE_PROJECT_REPONAME} |
branch -> ${CIRCLE_BRANCH} | commit -> ${GIT_COMMIT_DESC}"
https://slack.com/api/files.upload
Please help me for that.
Thanks

BrowserStack Jenkins Pipeline AppUploader "File not found at" Error

I'm trying to set up a basic BrowserStack sample App with Jenkins a Jenkinsfile for the Pipeline.
Reading the documentation of the BrowserStack plugin for Jenkins I came up with the following step:
// ...
stages {
stage('assemble') {
// Here the App gets assembled
}
stage('upload-to-browserstack'){
steps{
browserstack(credentialsId: '<credentials>'){
sh 'test -e app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk && echo exists || echo does not exist'
browserstackAppUploader('app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk'){
}
}
}
}
}
// ...
This results in the following error message:
[BrowserStack] Starting upload process.
[BrowserStack] Uploading app app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk to Browserstack.
[BrowserStack] [ERROR] File not found at app/build/outputs/apk/flavorProduction/debug/browserstack-sample-debug.apk
[BrowserStack] ERROR : App Id empty. ABORTING!!!
I can see, that the file exists on my Jenkins instance. How can I upload the APK to the BrowserStack server or am I using a wrong syntax for this?
You can use any of the two scripts in your Jenkins build step in order to upload an app and use the hash ID from the response.
result="$(curl -u ":" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=#/Users/Downloads/BStackSampleApp_1.ipa" | jq -r '.app_url')"
result="$(curl -u ":" -X POST "https://api-cloud.browserstack.com/app-automate/upload" -F "file=#/Users/Downloads/BStackSampleApp_1.ipa" | jq '.app_url' | tr -d \")"
You can then export the value of the result as the environment variable for the Jenkins configuration.

Configure push notification with parse-server

Hei, i'm trying to send push notification to android app that use parse-server.
My environment is local, and i'm using ubuntu 16.04.
If i try to send push by curl with this:
curl -X POST \
-H "X-Parse-Application-Id: myAppId" \
-H "X-Parse-Master-Key: myMasterKey" \
-H "Content-Type: application/json" \
-d '{
"channels": [""],
"data": {
"alert": "Hello!"
}
}' \
https://localhost:1337/parse/push
i get the error: "missing push configuration"
What configurations should i set? and where?
I'm using Titanium/Alloy to develope the app. I tryed to send push notification directly from the app with:
Parse.Push.send({
where: {
user: {
__type: "Pointer",
className: "_User",
objectId: userId
}
},
data: {
alert: "new notification!",
}
}, {
useMasterKey: true,
success: function() {
console.log("Successfull");
},
error: function(error) {
console.log("Some error occurred");
}
});
but i got the error "Cannot use the Master Key, it has not been provided". So i inizialized parse-server with Parse.initialize(applicationId, javaScriptKey, masterKey) getting still the same error.
Could you help me? It is important :(
Other little question: to create a cloud function with local parse-server on ubuntu, where should i put my main.js file? i have the directory /usr/local/lib/node_modules/parse-server.
If you can answer at least one of this questions, please do! Thanks
Regards, Luca

Parse Server: Can not find sender for push type android

I do send push notifications with my parse-server like this:
curl -X POST \
-H "X-Parse-Application-Id: XXXXXXXXXXXXXXX" \
-H "X-Parse-Master-Key: XXXXXXXXXXXXXXX" \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceType": {
"$in": [
"ios"
]
}
},
"data": {
"title": "The Shining",
"alert": "All work and no play makes Jack a dull boy."
}
}'\ https://myserver.com/parse/push
In the logs I always see this error message:
Mar 18 14:35:18 xsn-app parse-app[31790]: Can not find sender for push type android, {"where":{"deviceType":{"$in":["ios"]}},"data":{"title":"The Shining","badge":"1","alert":"All work and no play makes Jack a dull boy."}}
The device does receive the push notification just fine though.
I do not send push notifications to android devices. There is not even one registered. I also have not configured android push in my parse server configuration. There is only one single iOS device registered at the parse server.
Any idea why this happens?
it just tells U that it doesnt know how to send Push for Android. You can get rid of this error if you define the push for android with blank strings...
"android": {
"senderId": "...",
"apiKey": "..."
},

Setup Node for android on Selendroid on Selenium GRID

Setting up android as a node on Selenium GRID remains the last part by adding the .json configuration file to the selendroid .bat file left me confused. I ave tried it in several ways but still remain dump not responding as expected. These are the .bat files:
Selendorid:
java -jar selendroid-standalone-0.13.0-with-dependencies.jar -app selendroid-test-app-0.14.0.apk -port 5555
Selenium GRID server:
java -Dfile.encoding=UTF-8 -cp "selendroid-grid-plugin-0.14.0.jar;selenium-server-standalone-2.44.0.jar" org.openqa.grid.selenium.GridLauncher -capabilityMatcher io.selendroid.grid.SelendroidCapabilityMatcher -role hub -host 127.0.0.1 -port 4444
The nodeconfig.json file:
{
"capabilities": [{
"browserName": "selendroid",
"maxInstances": 1,
"aut": "io.selendroid.testapp:0.14.0"
}, {
"browserName": "android",
"maxInstances": 1
}],
"configuration": {
"maxSession": 1,
"register": true,
"hubHost": "localhost",
"hubPort": 4444,
"remoteHost": "http://localhost:5555",
"proxy": "io.selendroid.grid.SelendroidSessionProxy"
}
}
how do I add the nodeconfig.json to the selendroid to make it work? I have tried thus:
java -jar selendroid-standalone-0.13.0-with-dependencies.jar -app selendroid-test-app-0.14.0.apk -port 5555 -role node nodeconfig: nodeconfig.json
which did not work. How od I get it working?
Use cUrl to register the Selendroid Node to the WebDriver grid HUB.
I use a bat file with this contents (on Windows):
REM - Register a Selendroid WebDriver node to the Hub using CURL
"C:\opt\grid\curl-7.40.0\curl.exe" -H "Content-Type: application/json" -X POST --data #selendroid-node-config.json http://{IP-of-your-Grid-Hub}:4444/grid/register
In the Nodeconfig.json specify the selendroid capabilities.
If you are on a Windows machine you can download and use cUrl via this StackOverflow question: How do I install/set up and use cURL on Windows?
You have used:
java -jar selendroid-standalone-0.13.0-with-dependencies.jar -app selendroid-test-app-0.14.0.apk -port 5555 -role node nodeconfig: nodeconfig.json
Try to change the ":" to: "--" (after nodeconfig).

Categories

Resources