Android issue in using redlaser sdk - android

I am using redlaser api in my app. I am getting "Resource not found" exception in the anim folder. But I am not using any of the animation file in the acitivity where I am using the redlaser. Its showing the error in the first file of anim folder, If I delete that file, then its showing the error in the next file (which is first now).
I have attached the exception as screen shot here
You can see that the error is there in the api, showing the error in the following line
com.ebay.redlasersdk.scanner.BarcodeScanActivity.initBeepSound(BarcodeScanActivity.java:353)

In the getBeepResource() method that you have implemented in your activity, fully qualify the name of the resource by adding the package name of your R.java file. For example, in the RLSample project the getBeepResource() method is implemented in the RedLaserSDK.java file. In that method replace the line returning the resource with this line:
return com.ebay.rlsample.R.raw.beep;
This will fix the issue. Do the same in your app code as well (changing the package name to match your app).

Related

Error while loading gif image source

I tried executing the following line to load gif image, programatically.
gifInputStream = context.getResources().openRawResource(R.drawable.image);
But, studio used to indicate an error near "R.drawable.image".
I found a solution, or rather hack around to my issue. I just added "+" symbol. So, the line looks like this now...
gifInputStream = context.getResources().openRawResource(+R.drawable.image);
AndroidStudio doesn't show any error now.
it required raw file not drawable.
Please create res/raw/ directory and move your file in the raw directory.
after then:-
context.getResources().openRawResource(R.raw.yourfilename)

Meteor run android-device failing: How to correctly define launchScreens

Trying to change the default splash screen on my meteor app. Running meteor run android-device produces a long error message (see relevant section below).
From what I gather, it seems the three nine patch files are being referenced twice...but I have no idea how to de-reference them.
The app worked before I added the following to my mobile-config.js and added the actual image files. Commenting out the three android lines does not help. Deleting the nine patch files will also not help.
App.launchScreens({
'android_xhdpi_portrait':'splash/xhdpi.9.png',
'android_hdpi_portrait':'splash/hdpi.9.png',
'android_mdpi_portrait':'splash/mdpi.9.png',
'ipad_portrait_2x':'splash/ipad_portrait_2x.png',
'ipad_portrait':'splash/ipad_portrait.png',
'iphone_2x':'splash/iphone_2x.png',
'iphone5':'splash/iphone5.png',
'iphone6':'splash/iphone6.png',
'iphone6p_portrait':'splash/iphone6p_portrait.png'
});
I'm quite sure the images only exist in the directory once. I know the path is correct because the ios splash images work perfectly.
Here is the relevant piece of console output:
res/drawable-port-mdpi-v4/screen.png:0: error: Resource entry screen is
already defined.
res/drawable-port-mdpi-v4/screen.9.png:0: Originally defined
here.
res/drawable-port-hdpi-v4/screen.png:0: error: Resource entry screen is
already defined.
res/drawable-port-hdpi-v4/screen.9.png:0: Originally defined
here.
res/drawable-port-xhdpi-v4/screen.png:0: error: Resource entry screen is
already defined.
res/drawable-port-xhdpi-v4/screen.9.png:0: Originally defined here.
The meteor docs state:
For Android, launch screen images should be special "Nine-patch" image files that specify how they should be stretched.
The Android docs state (in relation to nine patch files):
It must be saved with the extension .9.png...
I used the nine patch generator here (googlecode.com) that automatically takes a .png and outputs .9.png files.
However, using the .9.png file extension was the issue here. For some reason, the cordova/meteor build process did not handle files already in .9.png format.
Final answer: If using a .9.png generator, rename the files to just .png before adding them to your meteor project.

No resource found that matches #drawable/test err android studio

I've tried all solutions. Finally decided to post this question.
The situation is as follows:
My drawable has test.png image which I use in my project.
In eclipse it works perfectly but in Android Studio it doesn't work.
Also I'm not getting any compiler error.
I am getting only this type of error almost 54 times when cradle build. As this image is set of as background to 54 screens. :(
What could be the problem?
You should remove the extension part.
For example if your image is called mimg.png in your
resource files you should access it via #drawable/mimg.
Edit
If in eclipse is fine, then create the project new and add file by file. I also had this issues and after some tries ai gave up and created new and after added file by file.
As an alternative please check if you add it in other drawables folders.
That's it.
You need to reference your drawable without the extension: Like this:
android:src="#drawable/test"
Remove the image extension from your xml file and try that please!

Why am I not able to create android xml file?

I am creating a new project, target of this project is "GALAXY tab addon". I am creating a new xml file in layout folder an I am getting following screen which was not the case when I was developing for 2.2 or so. Where do I go next, it says the options are "optional" so I skipped them and clicked finish- No Response, I also tried selecting some options and still the file is not creating. What am i missing here?
IDE used is Eclipse.
You dont need to go till this window.you can finish creating xml file before this window like the below image.
Just click on finish button here and your xml file will be created.

android Traceviewer

I am Trying to use trace viewer by
Debug.startMethodTracing("sampletrace");
Debug.stopMethodTracing();
And I pull the sampletrace to a folder from sdcard.
When I try to view the tracefile using the following command.
D:\Android\android-sdk-windows\tools>traceview D:\trace\sampletrace.trace
it is showing the following line
Key section does not have an *end marker
Can anybody please explain what is this?
in your eclipse file-explorer window, in sdcard your traceview file size is 0 because
you can not properly call Debug.stopMethodTracing() method in your code.
you have to call it when you are finished your application.
when you finished your application in emulator your traceview file size is now not a 0(zero).
now execute your next step as describe in api.
You need to call a corresponding Debug.stopMethodTracing(). Without this call the trace is incomplete and you'll see this marker error when you try to load it in the traceviewer

Categories

Resources