[Q] Class not found exception - Android Software Development

I am trying to send an email using javamail api.I have mail.jar,activation.jar and additionnal.jar added to the classpath.But when the app reaches the line where I create a MimeMessage object,it crashes and ClassNotFoundException is thrown for class java.awt.datatransfer.Transferable.Can anyone help how to fix this problem?Thanks!

The android framework classes do not include java.awt.datatransfer, hence you can't user any java code that uses them.

I need to send emails in my app using other account other than the default one on the device.Can you tell me where can I download jar file with the necessary package or give me a code example how to solve my problem?

Related

Trusted Applications on WM5

Hello,
I have problems with different applications under Windows Mobile 5.0. When i try to run them i get the following error.
Code:
The file 'foo' cannot be opened. Either it is not signed with a trusted certificate, or one of its components cannot be found. You might need to reinstall or restore this file.
Is there anyway of disabling the checks for trusted applications in Windows Mobile 5.0 on the Wizard?
Does this help? (From Windows Mobile Blog)
Code:
This post will be a quick reference to the application security model in WM 2005. I'll gloss over some fine details in order to cover the broad points.
For CreateProcess() or running any executable
First, examine the signature on the binary. The three possibilities are that it is signed privileged, signed unprivileged, or unsigned. (determined by checking the Authenticode signature)
If signed by cert that chains to Privileged Execution Authorities store:
App runs privileged(CeGetCurrentTrust() == 2)
Else if signed by cert that chains to Unprivileged Execution Authorities store:
If device is one-tier (policy 4123 == 1)
App runs privileged.
else (two-tier)
App runs unprivileged. (CeGetCurrentTrust() == 1)
Else if app is unsigned
If unsigned apps are blocked (policy 4102 == 0)
App fails to load. (returns NTE_BAD_SIGNATURE).
Else if the device prompts, and the prompt times out or the user presses No
App fails to load.
Else if we are configured not to prompt (policy 4122 == 1) or the user accepts the prompt
If device is one-tier
App runs trusted.
else (two-tier)
App runs untrusted.
Greetings,
Brezel
This is from the wiki. It works on the Universal, should work on WM5 generally I guess:
Code:
Allow the unsigned app from installing for everything.
HKEY_LOCAL_MACHINE\Secutiry\Policies\Policies] Change value 0000101a from 0 to 1
Do a soft reset.
I think that's just for installing, not running. Tell me if it works.
V
On my Wizard that key already has a value 1, perhaps I should change it to 0 to get this effect? have no app to install right now, but will try if I install next time.
because..
..wizard has much older version of ROM than Universal. The old ROMs of Universal has the value 1 too..
I changed the following registry values
Code:
HKLM\Security\Policies\Policies\00001001 = 1 (RAPI)
HKLM\Security\Policies\Policies\00001005 = 40 (Cert)
HKLM\Security\Policies\Policies\00001017 = 144
HKLM\Security\Policies\Policies\0000101B = 1
HKLM\Security\Policies\Policies\0000101B = 0
HKLM\Security\Policies\Policies\00001006 = 1
Those values change nothing at all. The only difference is that i am not asked to allow installation of non certified applications. My problem, however, is not the installation, which works, but the application. Whenever i try to run it i get the error mentioned above. It is just not possible to run certain applications without certificate.
Greetings,
Brezel
I got the exact error and have asked for help on this forum and on HowardForum without any luck
You could re-sign the application using your own code signing certificate and add your certification authority certificate to trusted root certificate authorities on your WM5 device. :wink:
V-Ger said:
You could re-sign the application using your own code signing certificate and add your certification authority certificate to trusted root certificate authorities on your WM5 device. :wink:
Click to expand...
Click to collapse
I tried this, but without success. I already have my own root cert installed on the device (for SSL Activsync) and that works fine, but the app still won't work as a "signed app" :-(
Have you got this working?
Yes I tried it and it works!
1.First you have to issue a Code signing certificate:
- Add a code signing template using Certification Authority snap-in
- Issue a code signing certificate
2. Download and Extract code signing tools:
http://ftp.intron.ac/pub/security/raw/codesigningx86.exe
3. Run signcode.exe on WM5 executable file using the certificate you created earlier.
4 Copy executable file to WM5 device
V-Ger said:
Yes I tried it and it works!
1.First you have to issue a Code signing certificate:
- Add a code signing template using Certification Authority snap-in
- Issue a code signing certificate
2. Download and Extract code signing tools:
http://ftp.intron.ac/pub/security/raw/codesigningx86.exe
3. Run signcode.exe on WM5 executable file using the certificate you created earlier.
4 Copy executable file to WM5 device
Click to expand...
Click to collapse
I did create a code-signing cert in Certsrv, but I must have cocked something up. I will try again this afternoon and let you know.
Thanks for the help
V-Ger said:
Yes I tried it and it works!
1.First you have to issue a Code signing certificate:
- Add a code signing template using Certification Authority snap-in
- Issue a code signing certificate
2. Download and Extract code signing tools:
http://ftp.intron.ac/pub/security/raw/codesigningx86.exe
3. Run signcode.exe on WM5 executable file using the certificate you created earlier.
4 Copy executable file to WM5 device
Click to expand...
Click to collapse
Ok, this is what I did (and it still didn't work):
1) Installed my own trusted-root CA onto my Mini S by opening the .cer file. This bit definately works as I'm able to sync my email with Exchange over SSL and this doesn't work unless the correct root cert is installed
2) Added a code-signing template in certservices with default settings. (Custom templates are not allowed in my Windows Std edition :-( )
3) Using IE, create a code-signing cert with default settings. Also export the private keys into a PVK file.
4) Using cert2spc, convert the cer file to an spc file
5) run signcode -spc cert.spc -v privkeys.pvk filetosign.exe ("Result successful with warning about file not being timestamped)
6) Copy .exe to device and run - still whinges about unknown publisher
Bah. Any suggestions as to what I'm doing wrong?
Daern
I have the same very irritating problem.
1.First you have to issue a Code signing certificate:
- Add a code signing template using Certification Authority snap-in
- Issue a code signing certificate
How do I do that ?
daern said:
V-Ger said:
Yes I tried it and it works!
1.First you have to issue a Code signing certificate:
- Add a code signing template using Certification Authority snap-in
- Issue a code signing certificate
2. Download and Extract code signing tools:
http://ftp.intron.ac/pub/security/raw/codesigningx86.exe
3. Run signcode.exe on WM5 executable file using the certificate you created earlier.
4 Copy executable file to WM5 device
Click to expand...
Click to collapse
I did create a code-signing cert in Certsrv, but I must have cocked something up. I will try again this afternoon and let you know.
Thanks for the help
Click to expand...
Click to collapse
Ah. More success now. I've switched to using "signtool.exe signwizard" and that has enabled me to get it working...
daern said:
Ah. More success now. I've switched to using "signtool.exe signwizard" and that has enabled me to get it working...
Click to expand...
Click to collapse
Bugger. Too quick off the mark. It's still not working. Arrrrrgh!
easycure1974 said:
I have the same very irritating problem.
1.First you have to issue a Code signing certificate:
- Add a code signing template using Certification Authority snap-in
- Issue a code signing certificate
How do I do that ?
Click to expand...
Click to collapse
[WIN2k3 Server]
START/All Programs/Administrative Tools/Certification Authority
SERVER/Certificate Templates/New/Certificate Template to Issue
http://servername/certsrv
-Request a Certificate
-advanced certificate request
-Create and submit a request to this CA
-Certificate Template: Code Signing
[leave default settings]
-SUBMIT
Thank you - shall try and if that could help me solve this annoying problem !
V-Ger said:
Yes I tried it and it works!
1.First you have to issue a Code signing certificate:
- Add a code signing template using Certification Authority snap-in
- Issue a code signing certificate
2. Download and Extract code signing tools:
http://ftp.intron.ac/pub/security/raw/codesigningx86.exe
3. Run signcode.exe on WM5 executable file using the certificate you created earlier.
4 Copy executable file to WM5 device
Click to expand...
Click to collapse
Are you *absolutely* sure that this works? I am now sure that I am doing this right, but I don't believe that apps signed against a certificate that only exists in the public root store (i.e. the one used for SSL connections) will be accepted as "valid". I've tried every way I can think of getting this to work, but with no success :-(
When I posted to say that it was working, what I actually saw was PPC recognising a file with a different file name, but the same CRC as a file that I had already said "Yes, I know it's unsigned. Run it anyway". Even though the new file was a different name, WM2005 ran it anyway without comment, as it assumed (correctly) that it was the same file with a different name... As I haven't yet found a way to make WM2005 forget the exes that I have accepted (I assume it's in the reg somewhere) I have now resorted to recompiling the same exe each time, but with different resource data, thus ensuring it's always different!
What device are you using to test this? I wonder if your derivative of the HTC Wizard has different certs installed than mine (UK O2 XDA Mini S)
Would it be possible for you to send me a sample .exe and your own root cert for me to test on my device. At least then I'll know if it's my device or my technique that is causing me problems ;-)
Thanks
Daern
Yes, I am positive it works. I am using Universal (Qtek 9000), but that shouldn't make any difference.
Besides the error message after each soft reset.
I can still install many software and use it smoothly.
Haven't seen any other problem yet.
What is the certificate about?
At the risk of appearing as a heretic..is there any way that this problem (which I get when clicking on any hyperlink) is related to the SdkCerts.CAB installed as part of ozVGA?
Dumb idea I know however I have no idea of what that CAB did. Can I somehow remove its effects just to prove it isn't the cause? ..hope this isn't off topic.
J

[Q] Flash Global Security Settings

Hello,
I'm trying to make an application that uses a webview to load a page containing a swf which should be populate with data loaded from a localfile.
The main idea, is that if I want to open that html from my computer directly, I should go to :
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html
... and add the swf as a trusted file. If I copy the files inside tomcat, and start the tomcat, I can view thee swf with all data loaded
Now, in android I can't open that page to change the Global Security Settings, so I can't load the data. Do you have any idea how to do this? Or a workaround to this?
Ok, I see that no one has any idea.. But what about creating a tiny web server that returns that page? I think it should do the trick, but I can't find any tutorial about creating web servers in Android.. basically I need to open a port and return the html from @assets relative to what's after localhost : port. Do you know, or have a sample that I could use it as an example?

[Q] [WIFI Monitoring] Toolchain and Linking

Hi everybody,
It's my first post on XDA, because I always got my answer on the differents topics I found.
I'm actually working on monitoring network. I use the firmware provide by these brillant guys :
http bcmon blogspot ie/.
I want to developp an native code to write a easy airodump-ng like, to monitoring the traffic close to my device.
I need to use radiotap headers to do what I want, and of course a monitoring access to my wireless card.
So I reverse the bcmon.apk provided by bcmon team, to look how they lauch airodump-ng in a term. I noticed they use LD_SHARED=`pwd`/libs LD_PRELOAD=`pwd`/fakedriver.so.
My first problems : my toolchain (provided by NDK) don't have radiotap header access, and I really don't know how to add these last one to it.
My second problems : how to compile my code with the LD_SHARED/ LD_PRELOAD libraries used by bcmon drivers to ensure I'll be able to execute my code with the monitor mode activated. I think that I will have to add the libs contained on /data/data/com.bcmon.bcmon/files/libs
on these of my toolchains, but I really don't know.
I read a lot papers to understand how linking works in C, but I'm probably still missing something.
I really don't know how to improve my toolchain, and I'm quite anoyed because I haven't progressed in my work for days...
Any help will be really appreciated.
Thanks a Million
Ant.
I found a solution few weeks ago.
I had linking erros.
I reserved the .apk provided by bcmon guys.
For those that want to develop using monitoring functionnalities, there is the way to do :
LD_PRELOAD=/data/data/com.bcmon.bcmon/files/libs/libfake_driver.so LD_LIBRARY_PATH=/data/data/com.bcmon.bcmon/files/libs ./yourprog
If you want to comiple your code using some of their libraries, for example pcap libraries I have done the fellowing stuffs :
1- found radiotap headers, and pcap headers on github likes websites.
2- try to cross compile with the headers
3- Correct the erros (like typedef missing ...)
4- Build your make file adding name of the libraries :
GCC={your toolchain}
FLAGS={your flags}
LIBS=libfake_driver.so \
libpacap.so.1
OBJ = {your obj}
output :
$(GCC) $(OBJ) -c {yoursrcfile) -o {output} $(FLAGS) $(LIBS)
Hope it 'll help.
Ant.

Android studio wont work with an api

So, I am currently messing around with android programming, and i am using android studio and my ide of choice. I have made a few simple apps(calculator and whatnot) without issue. But now i am trying to make an app using the youtube data api. I can not even get started on it though because i cant get the api to work. Heres what i have done so far.
I have taken the api zip file and unzipped it. This produced an youtube folder. I than copied this folder to the libs folder in my project. This caused no issues in and of itself.
I than tried to add some imports based on the api and that caused an syntax error
To fix that error i added the following lines to the build.gradle in the dependencies section at the bottom
Code:
compile fileTree(dir: 'libs/youtube', include: '*.jar')
compile fileTree(dir: 'libs/youtube/libs', include: '*.jar')
This fixed the syntax errors and also allowed it to build successfully
The issue comes when I try to actually add something based on the api. When i add the following lines of code...
Code:
/** Global instance of the HTTP transport. */
private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
/** Global instance of the JSON factory. */
private static final JsonFactory JSON_FACTORY = new JacksonFactory();
/** Global instance of Youtube object to make all API requests. */
private static YouTube youtube;
there are no syntax errors, but when i attempt to build it I get a single error
Code:
Gradle: Execution failed for task ':ApiTest2:dexDebug'.
> Failed to run command:
/Applications/Android Studio.app/sdk/build-tools/android-4.2.2/dx --dex --output /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/build/libs/ApiTest2-debug.dex /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/build/classes/debug /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/build/dependency-cache/debug /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-api-client-servlet-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-oauth-client-servlet-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-api-client-protobuf-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-http-client-jdo-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/google-api-services-youtube-v3-rev70-1.16.0-rc-sources.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/transaction-api-1.1.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-http-client-appengine-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/jackson-core-asl-1.9.11.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/protobuf-java-2.4.1.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/httpclient-4.0.1.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-oauth-client-java6-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/gson-2.1.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-http-client-gson-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/commons-logging-1.1.1.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-http-client-android-1.16.0-rc.jar /Applications/Android Studio.app/sdk/extras/android/m2repository/com/android/support/support-v4/13.0.0/support-v4-13.0.0.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/jackson-core-2.1.3.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-api-client-gson-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/google-api-services-youtube-v3-rev70-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-oauth-client-java7-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-api-client-android-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/jetty-util-6.1.26.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-http-client-jackson-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/httpcore-4.0.1.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/jetty-6.1.26.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-oauth-client-jetty-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-oauth-client-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/jdo2-api-2.3-eb.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-oauth-client-appengine-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-http-client-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-api-client-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/google-api-services-youtube-v3-rev70-1.16.0-rc-javadoc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/jsr305-1.3.9.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-api-client-appengine-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-api-client-java6-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/xpp3-1.1.4c.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-http-client-jackson2-1.16.0-rc.jar /Users/Andrew/AndroidStudioProjects/ApiTest2Project/ApiTest2/libs/youtube/libs/google-api-client-jackson2-1.16.0-rc.jar
Error Code:
1
Output:
trouble processing "javax/transaction/HeuristicCommitException.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.
However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.
If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.
If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.
If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.
1 error; aborting
And i am not sure why this is happening. I am sure I am doing something wrong, but I havent found anywhere online where i shows how to do this exactly and through all my tinkering i havent gotten it to woerk.
Any help
Anyone have any ideas? Over 100 views and no replies
Hi,
although I haven't face the same problem, I think I can analyze your problem.
It's because dependencies in your gradle.build
You can't declare 2 "compile"(s) statement like what you've done.
Code:
compile fileTree(dir: 'libs/youtube', include: '*.jar')
compile fileTree(dir: 'libs/youtube/libs', include: '*.jar')
That's wrong, though I don't know how to solve that given that I'm still learning about it.
I thought that these links can help you solve it:
- http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
- http://www.gradle.org/docs/current/userguide/dependency_management.html
JoshieGeek said:
Hi,
although I haven't face the same problem, I think I can analyze your problem.
It's because dependencies in your gradle.build
You can't declare 2 "compile"(s) statement like what you've done.
Code:
compile fileTree(dir: 'libs/youtube', include: '*.jar')
compile fileTree(dir: 'libs/youtube/libs', include: '*.jar')
That's wrong, though I don't know how to solve that given that I'm still learning about it.
I thought that these links can help you solve it:
- http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
- http://www.gradle.org/docs/current/userguide/dependency_management.html
Click to expand...
Click to collapse
curious if either one of you figured it out.
If you are trying to use youtube api add the following line to the gradle build.
Code:
compile 'com.google.apis:google-api-services-youtube:v3-rev107-1.18.0-rc'
You dont need to download and copy the youtube project into your project.

[Q] Reverse engineering app communication

Hello there,
i would like to get informations about the communication of an app, as it is using a VERY big amount of bandwith. And I'm curious.. I want to understand the complete communication.
I tried mitmproxy but it seems, that it is using a hardcoded proxy internally. So i thought about a different approch:
Adding Logging to the app itself.
The App is using a stripped down version of the okhttp lib (github.com:square/okHttp), that contains (in versions 1.5.0 to 1.6.0) the Request class. The constructor seems to not be changed in the app.
github.com/square/okhttp/blob/parent-1.5.0/okhttp/src/main/java/com/squareup/okhttp/internal/http/Request.java
I would like to add logging capability to the constructor in th compiled .class . Something like
Log.d("AppTarget",url.getProtocol()+"://"+url.getHost()+":"+url.getPort()+url.getPath()+" "+method);
at the end of the constructor.
1) Is this a good idea? (Or are there better ways? )
2) How to do this? Of course: I have to edit the bytecode. But more like: how to do this.
3) I have attached a compiled version of the lib
A wonderfull day
Mimoja
Well decompiling the app, adding the logging lines and recompiling wont work i suppose, because apktool etc dont return working code.
If you have another rooted android phone by chance, you should try intercepter-ng app found here on xda, works great as mitm tool to get other wifi device's traffic
--------------------
Phone: Nexus 4
OS: rooted Lollipop LRX21T
Bootloader: unlocked
stock Recovery

Categories

Resources