aws devicefarm python upload apk - android_app_aapt_debug_badging_failed - amazon-web-services

I am uploading the APK using python code, when I check for status after create_upload and uploading the actual file then I keep getting FAILED with android_app_aapt_debug_badging_failed. Any Idea why ?

Sorry to hear that you are running into issues with the upload.
For the error code you are facing, i am pasting the debugging steps below
Debugging Steps
During the upload validation process, AWS Device Farm parses out information from the output of an "aapt debug badging " command.
Make sure that you can run this command on your Android application successfully. In the following example, the package's name is app-debug.apk.
Copy your application package to your working directory, and then run the command:
$ aapt debug badging app-debug.apk
A valid Android application package should produce output like the following:
package: name='com.amazon.aws.adf.android.referenceapp' versionCode='1' versionName='1.0' platformBuildVersionName='5.1.1-1819727'
sdkVersion:'9'
application-label:'ReferenceApp'
application: label='ReferenceApp' icon='res/mipmap-mdpi-v4/ic_launcher.png'
application-debuggable
launchable-activity: name='com.amazon.aws.adf.android.referenceapp.Activities.MainActivity' label='ReferenceApp' icon=''
uses-feature: name='android.hardware.bluetooth'
uses-implied-feature: name='android.hardware.bluetooth' reason='requested android.permission.BLUETOOTH permission, and targetSdkVersion > 4'
main
supports-screens: 'small' 'normal' 'large' 'xlarge'
supports-any-density: 'true'
locales: '--_--'
densities: '160' '213' '240' '320' '480' '640'

I was having this exact issue, and none of the suggestions were doing any good.
The fix was to assign the file to data instead of files.
def upload_app(path):
url, arn = create_signed_upload('ANDROID_APP')
headers = {'content-type': 'application/octet-stream'}
with open(path, 'rb') as app:
requests.put(url, data=app, headers=headers)
success = wait_on_upload(arn)
return success

Related

Lambda not connecting to ffmpeg

I have an issue with a Lambda function that tries to use ffmpeg as a third party on AWS. The function itself uses ffmpeg.js library which generates ffmpeg commands in it's functions, when they are called. I installed ffmpeg on my instance via SSH, and it's still giving me the same error
Command failed: ffmpeg -i "....
ffmpeg: command not found
Any advice on this? Many thanks
You need to include static build of ffmpeg inside your project directory
Download x86_64 version. As it the one used my lambda environment
Unzip the file and copy ffmpeg named file which is binary build and paste it in your project directory.
After that on the top of your code paste the following snippet:
process.env.PATH = process.env.PATH + ':/tmp/'
process.env['FFMPEG_PATH'] = '/tmp/ffmpeg';
const BIN_PATH = process.env['LAMBDA_TASK_ROOT']
rocess.env['PATH'] = process.env['PATH'] + ':' + BIN_PATH;
Now inside your exports.handler, paste the following line of code in the beginning of function call. It will look like this
exports.handler = function(event, context, callback) {
require('child_process').exec(
'cp /var/task/ffmpeg /tmp/.; chmod 755 /tmp/ffmpeg;',
function (error, stdout, stderr) {
if (error) {
console.log('Erro occured',error);
} else {
var ffmpeg = require('ffmpeg');
// Your task to be performed
}
}
)
}
I hope this helps. Don't forget to leave a thumbs up :)
Above solution is for Node.js language
I successfully can work with ffmpeg on AWS Lambda in Python:
Get static build of ffmpeg from here.
Untar with tar -zxvf ffmpeg-release-amd64-static.tar.xz
Fetch file ffmpeg (and optionally ffprobe) from folder and delete rest of files.
Put bare ffmpeg file (without the subfolder) in the same folder as your lambda code.
cd into this folder and zip with zip -r -X "../archive.zip" *
Upload zipped file to AWS Lambda and save.
In your Python code you need to set the correct filepath to the ffmpeg static build like so:
FFMPEG_STATIC = "/var/task/ffmpeg"
# now call ffmpeg with subprocess
import subprocess
subprocess.call([FFMPEG_STATIC, '-i', input_file, output_file])
I didn´t have to change any file permissions. This wouldn't have worked anyways because /var/task/ doesn't seem to be writeable.
input_file and output_file are local files in your spawned Lambda instance. I download my files from s3 to /tmp/ and do the processing with ffmpeg there. Make also sure to set sufficient memory and timeout for the Lambda (I use maximum settings for my workflow).

Error:- tensorboard: command not found . However, while typing locate tensorboard, I am getting the the location

I am a beginner in tensorflow. I ran a simple script as below :
import tensorflow as tf
a =tf.constant(2)
b = tf.constant(3)
c = tf.add(a,b)
with tf.Session() as sess:
writer = tf.summary.FileWriter('./graphs',sess.graph)
print sess.run(c)
writer.close()
After saving this python file, I ran it in terminal. There is folder graphs created with 2 events file. Then I ran following command on terminal :
tensorboard --logdir="./graphs"
I am getting following error:
tensorboard: command not found
Please help. Thanks in advance.
​
As you mentioned you are getting tensorboard location, try to run your command with your local path, ex
/your/path/tensorboard --logdir="./graphs"
Hope this will help you, happy coding

changing default download location in chrome using Pytest_mozwebqa

Can anyone please help how do i change the chrome settings in selenium using pytest to download files to a desired location.
what should i add to the below command in run configurations of eclipse to change the download path
--baseurl='http://example.com'--driver=chrome
In Python itself, it would be:
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_experimental_option("prefs", {"download.default_directory": "some/path", "download.directory_upgrade": true})
driver = webdriver.Chrome(executable_path="the/path/to/the/driver.exe", chrome_options=chromeOptions)
Related: https://bugs.chromium.org/p/chromedriver/issues/detail?id=330
If I understand correctly how this "Pytest_mozwebqa" thingy works, you could try adding this command line:
--chromeopts='{"prefs":{"download.default_directory":"some/path","download.directory_upgrade":true}}'

Save Permissions Python

I am writing a program which tracks pay stub information. It runs fine when running it from source code via the terminal and saves files correctly. In order to distribute it to my client, I compiled the code using PyInstaller to create a 1 file .exe for distribution on Windows 7, and then used Advanced Installer 11.4.1 to create a .msi file for them to install on their platform.
My problem is when running the application after installing the .msi. In the package I distributed a .txt file with the data to load and save to.
When attempting to update the file I distributed the following error occurs:
IOError: [Errno 13] Permission denied: 'testSave.txt'
The code I'm using to try and save the file is:
saving = open(file_name, 'w')
saving.write(data)
Is there a way to tell Python 2.7 to write regardless of privileges, or to make this specific file have basic user privileges when installing?
Thanks.
I modified my program to write to a different location using the system environment and telling Advanced Installer to install the .txt in the Local App Data directory. This allowed me to open the file with 'rw' privileges.
path = os.environ.get('LOCALAPPDATA')
path = path.split('\\')
real_path = ''
print path
for dir in path:
real_path += dir + '/'
print real_path
real_path = os.path.normpath(real_path + 'PayTrakker/testSave.txt')
With Advanced Installer you can set permissions, but you need a licensed edition, i.e. Professional or higher.
You can also build a Professional project in the trial period, to test the permissions support and see if it will work for you.

Apache Axis2 throws NoSuchMethodError when trying to hit web service?

I am trying to hit the following web service with axis2: http://www.webservicex.net/geoipservice.asmx?WSDL
I have Axis2 locally, and I generated my classes by downloading the wsdl to my local drive and running:
./wsdl2java.sh -uri geoipservice.wsdl -p geoip -d xmlbeans -s -o geoip
This produced a build directory with a build.xml file in it, which i then ran "ant" in, and it produced a client jar in the libs folder.
I dropped this jar onto my classpath, and then I tried to hit the service using the following code:
GeoIPServiceStub stub = new GeoIPServiceStub("http://www.webservicex.net/geoipservice.asmx?WSDL");
GetGeoIPDocument req = GetGeoIPDocument.Factory.newInstance();
GetGeoIP gic = req.addNewGetGeoIP();
gic.setIPAddress("74.125.91.105"); // google.com
GetGeoIPResponseDocument resp = stub.getGeoIP(req);
System.out.println(resp.getGetGeoIPResponse().toString());
Things seem to run at first, and I see the results coming back in the syslog, but before it finishes it throws this exception:
java.lang.NoSuchMethodError: org.apache.axiom.om.impl.OMStAXWrapper.<init>(Lorg/apache/axiom/om/OMXMLParserWrapper;Lorg/apache/axiom/om/OMElement;Z)V
at org.apache.axiom.om.impl.llom.OMStAXWrapper.<init>(OMStAXWrapper.java:52)
at org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReader(OMElementImpl.java:795)
at org.apache.axiom.om.impl.llom.OMElementImpl.getXMLStreamReaderWithoutCaching(OMElementImpl.java:765)
at geoip.GeoIPServiceStub.fromOM(GeoIPServiceStub.java:767)
at geoip.GeoIPServiceStub.getGeoIP(GeoIPServiceStub.java:325)
I've googled all over and haven't been able to find what is causing this. Can anyone help me find what I'm doing wrong? Thank you.
You get NoSuchMethodErrors if your compiler used a different class definition (during compilation) to create your .class file then the jvm has at runtime.
In your case, it misses the constructor for org.apache.axiom.om.impl.OMStAXWrapper(org.apache.axiom.om.OMXMLParserWrapper, org.apache.axiom.om.OMElement)
It probably means you have the wrong org.apache.axiom library somewhere on your classpath.