j2me JAR Manifest, JAD File and Nokia Publish QA failure - java

Recently I've developed some application which is simple Weider 6 excersises browser.
I've created manually JAD file with elements from JAR manifest, however my application was revoked by Nokia Publish QA team with following reason:
Dear publisher,
While processing your content we found the following MIDlet-attributes are not present in the JAD and JAR manifest files:
Key 'MicroEdition-Profile' is not in the .jad and .jar.
Key 'MicroEdition-Configuration' is not in the .jad and .jar.
Key 'MIDlet-1' is not in the .jad and .jar.
Key 'MIDlet-Name' is not in the .jad and .jar.
Key 'MIDlet-Version' is not in the .jad and .jar.
Key 'MIDlet-Vendor' is not in the .jad and .jar.
What is really weird because my manifest looks like following:
MIDlet-Version: 1.0.0
MIDlet-Vendor: Michal Kulesza
MIDlet-Jar-URL: Weider6.jar
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-2.1
MIDlet-1: Weider6,/1.png,me.kulesza.WeiderExcercises
MIDlet-Name: Weider6
and JAD file is almost the same:
MIDlet-Jar-Size: 199784
Sealed: true
MIDlet-Version: 1.0.0
MIDlet-Vendor: Michal Kulesza
MIDlet-Jar-URL: Weider6.jar
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-2.1
MIDlet-1: Weider6,/1.png,me.kulesza.WeiderExcercises
MIDlet-Name: Weider6
Did anyone of you experienced such issue?
Am I doing anything wrong or it's their fault?

You can check the JAD File online with my JAD-Checker
jadcheck.appspot.com
You should probably also include these entries:
MIDlet-Icon
MIDlet-Description
But these missing entries can not be the reason for the error report you got.
To me it looks like something went wrong during uploading. For example, an error you can easy do: select the file to upload, but not confirm it to start the actual upload.
It happen to me that when I finally saved the whole form, the files were not uploaded, the system used my old files, and the QA has reexamined my old version.
Now before I submit to QA, I always download what I have uploaded, to check that the system has really my new files.
There is an extra "verify" button. It should catch errors like this one.

Related

.so file not found (unsatisfiedlinkerror), but it exist

I've been struggling with this for a while, and although I have found many having similar problems, their fixes don't seem to work for me. Perhaps I am misunderstanding something though, regarding of where the shared library files go after installing an APK.
Setup: Android, using a build.gradle file, and CMakeLists.txt since I want to run some C++ code using JNI. I followed the tutorial basically from https://developer.android.com/studio/projects/add-native-code, along with other pieces here and there from other websites.
My C++ code works correctly (it only returns a number). The APK generated can be unzipped, and I see all the .so files under the lib directory. Inside /lib there are four directories, each one for a different arquitecture, including my target (ARM). However, when I install the APK and try to run my C++ code portion, it returns an unsatisfiedlinkerror with the message saying "We looked for your .so file on nativeDirs under /system/lib and /vendor/lib, but we didn't find it)."
Now, if I instead push the .so file from the unzipped APK, into the location they mention, everything will run correctly (so at least my code is compiled correctly). Am I misunderstanding something? I was also reading that it appears that the .so files are not extracted from the APK anymore, but still, it's not finding it. I actually can't find the .so file in the system at all, but again, if I extract the APK it will be there.
My CMakeLists.txt simply have the parameters based on: https://developer.android.com/studio/projects/configure-cmake
cmake_minimum_required(VERSION 3.4.1)
add_library(native SHARED
nativeCode.cpp)
target_link_libraries(native
android
log)
I'm loading my library as:
static {
    System.loadLibrary("native");
}
My questions are:
First of all, where should the .so files exist in my device after installing the APK.
Should I specify in any way the location of where the .so files should be under CMakeLists.txt?
If I need to specify a path for the app to look for the .so files, where should this be?
Thank you for your help!
i'm answering your question one by one...
QUESTION : First of all, where should the .so files exist in my device after installing the APK ?
Starting From Android M, it supports uncompressed native libraries in APKs, which allows the platform to read the native libraries directly from the APK without having to extract them.It have the flag android:extractNativeLibs which is default false. This is why you don't see them in the "data/data/packagename/lib/" directory if you're testing on a device on Android M or later.
Ultimately for testing purpose you can use android:extractNativeLibs="true" in Application tag of AndroidManifest.xml, to see in "data/data/packagename/lib/" folder.
<application
android:extractNativeLibs="true">
...
</application>
QUESTION: Should I specify in any way the location of where the .so files should be under CMakeLists.txt?
Considering your nativecode.cpp in rootPath/app/src/main/cpp/nativecode.cpp, and your CMakeList.txt under roothPath/app , your CmakeList.txt add_library should be like below,
add_library( # Sets the name of the library.
nativecode
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/cpp/nativecode.cpp)
If you notice, i added relative path and i don't know about case Sensitive. please try with smallcase.
I noticed, you mentioned your lib name as "nativeCode" , but in Code you taken only (System.loadLibrary("native")), it should be nativeCode. make sure the name matches for your library.
Add path of your CMakeList.txt in build.gradle (App Level)
android{
...
externalNativeBuild {
cmake {
path "CMakeLists.txt" //consider this CMakeLists.txt inside rootPath/app/CMakeLists.txt
}
}
QUESTION : If I need to specify a path for the app to look for the .so files, where should this be?
If you follow above steps it will work, You no need to specify which is modern and easy way., but if you wish manually i'm sure it bit complex compared to above(atleast for me)
First you have to create .so files from your .cpp file. (for that,we can do with Android.mk and Application.mk)
Then, you can add following line in build.gradle app level.
android{
...
...
sourceSets {
main {
jniLibs.srcDir 'jniLibs' //consider this jniLibs folder under rootPath\app\src\main\jniLibs
}
}
}
Then, you have to add *.so files in rootPath/app/jniLibs/**/*.so.
You have to generate *.so files for all supported ARM like, ("x86", "x86_64", "armeabi", "armeabi-v7a", "arm64-v8a")
then your folder path something like ,
rootPath\app\src\main\jniLibs\arm64-v8a\libnativecode.so,
rootPath\app\src\main\jniLibs\arm64-v7a\libnativecode.so
and so on...
Hope, these clear your issues and your doubts aswell 🤞.

Is there a solution to custom-obfuscated files dissapearing from 1.8.8.jar?

I'm creating a custom hacked client for minecraft v1.8.8, and the custom-hack files that I have re-obfuscated keep getting deleted on-launch.
I have already tried re-adding the correct files into the .jar after running the Client, but it still was deleted even after everything.
I expected all the files to be working normally and kept inside the JAR, but when I launch minecraft ( set onto the hacked client's version ), the .jar gets deleted and put back into the folder, but with missing files. There is no error. Just lack of expected files inside compiled client.
This is because the Minecraft launcher check the files of the game when you launch it and if they are differents from the files on their server, it redownload them.
You can avoid that by deleting the "downloads" section at the begining of the file 1.8.8.json in the same folder of the 1.8.8.jar.
This section looks like that, if the json is not fomatted you can use a json formatter tool.
"downloads":{
"client":{
"sha1":"3870888a6c3d349d3771a3e9d16c9bf5e076b908",
"size":8461484,
"url":"https://launcher.mojang.com/v1/objects/3870888a6c3d349d3771a3e9d16c9bf5e076b908/client.jar"
},
"server":{
"sha1":"b58b2ceb36e01bcd8dbf49c8fb66c55a9f0676cd",
"size":8320755,
"url":"https://launcher.mojang.com/v1/objects/b58b2ceb36e01bcd8dbf49c8fb66c55a9f0676cd/server.jar"
},
"windows_server":{
"sha1":"5143618265b8a2d1d28bcadf206b7327738c2670",
"size":8714995,
"url":"https://launcher.mojang.com/v1/objects/5143618265b8a2d1d28bcadf206b7327738c2670/windows_server.exe"
}
}

Java ZipOutputStream extra file created when builiding Zip

I'm creating EPUB files from an application, using ZipOutputStream. When I look at the resulting zip file with Winzip, it seems to be OK, except that in addition to the files and folders I expect, there is an additional folder which should not be there and does not appear in the log output by the code.
My folder structure to be zipped is the same as the IBM Developerworks "Getting Started with EPUB" tutorial. Before I started all this, I created an epub according to the tutorial instructions using WinZip and it extracts correctly, and works correctly in Adobe Digital Editions 2.0.
c:
/myepub
/epub
mimetype
/META-INF
container.xml
/OEBPS
content.html
content.opf
stylesheet.css
title.html
toc.ncx
/images
cover.png
My Java class (194 lines) creates the zip using the relative part of each name, and the result contains everything that the WinZip-created version has, i.e. it looks like the structure above below the /epub folder.
My code log:
mimetype
META-INF/container.xml
OEBPS/content.html
OEBPS/content.opf
OEBPS/images/cover.png
OEBPS/stylesheet.css
OEBPS/title.html
OEBPS/toc.ncx
But in addition there is:
/myepub
/epub
/OEBPS
images
Note that images here is not a folder, it is a zero-length file.
When I try to extract this with WinZip, it fails with:
Extracting to "C:\myepub\extract\"
Use Path: yes Overlay Files: no
Extracting OEBPS
C:\myepub\extract\OEBPS exists but is not directory
unable to process C:\myepub\extract\OEBPS\images.
I must be missing something very fundamental here. Can anyone point me in the right direction?

nokia error code 217 - jar manifest end of line

I have developed a J2ME application with J2ME Polish. Nokia now validate contents that will be submitted to the store, the challenge is that during validation of my JAR and JAD files, I get Error 217 - The JAR manifest does not end with a new line
I checked my JAR manifest and finds out that it is ending with a new line. Is anyone having any suggestions or solutions?
Double check that there are no invisible characters like whitespace or tab at the last line of the manifest.
If manifest has a newline indeed, error message apparently means a bug in this Nokia device.
Still, it is possible that your manifest has something wrong and that Nokia only used incorrect message to indicate some other problem in it. Getting messages like this, make sure that your manifest conforms to respective sections of JAR file Specification (available online), particularly:
Manifest Specification
Notes on Manifest and Signature Files
First I'd check is that manifest lines do not exceed "72 bytes (not characters), in its UTF8-encoded form".
Another thing worth trying is to experiment with various styles of line endings of those specified: CR LF | LF | CR. In your IDE / build there could be a setting to manage that, look for something called like "DOS / Unix / Mac line breaks". Specification states that all these are OK, but you better account for a chance of bug in the device not being able to recognize particular style line breaks.
Also consider checking / asking at Nokia forums for this might be a known issue with particular device.
Finally got this, i used the jar tool provided by the java sdk to extract the midlet from the jar file like this:
jar xf myjarfile.jar META-INF/MANIFEST.MF
then edited the file in a text editor and updated the manifest in the jar file
jar umf META-INF/MANIFEST.MF myjarfile.jar
Thanks for suggestions guys.
optionally you can open your jar file using winrar software then you can access the manifest from the META - INI file.from this you can edit it using the text editor after which you can save CAUTION:after saving note that the size is going to change so make sure you check the size of the jar after you have edited , by right clicking then view properties.check the size then change it accordingly to jad file by opening your jad file in a text editor
thats it:-0

Blackberry JDE generating bad .jad file (does not match compiled .cod file)

I Have a BB application that gets compiled into 3 siblings cod file. ( actualy one cod fil contaning 3 sub cod files).
app.cod
|--app.cod
|--app-1.cod
|--app-2.cod
which is normal.
the jad refers to those 3 inner .cod files.
Now I have add some feature to my app, it is getting a little bit bigger.
the jad now refers to 4 inner .cod files.
but there is still 3 inside the app.cod that is generated.
so I now still have
app.cod
|--app.cod
|--app-1.cod
|--app-2.cod
but with the jad referring to app.cod, app-1.cod, app-2.cod, AND app-3.cod.
this is causing OTA download to fail with the following error:
907 invalid COD HTTP Error 404 : not
found
what is wrong the my compiled program? is it a bug from the JDE?
I am using JDE 4.5
My assumption is that somehow the jad builder got confused, and maybe it gained a little more space in compression than it expected? either add another image to you application to make it a little larger or you can use
updateJad.exe app.jad
this will update the sizing of the jad file to match everything.
the file is located in the /bin folder with javaloader and other files of your JDE install.

Categories

Resources