Hi Guys,
I want to create a xslx-File in my Android Application. Im Using Apache poi-ooxml-3.12.jar for it. But while calling the XSSFWorkbook Constructor I get the following exception:
FATAL EXCEPTION: main
Code:
java.lang.VerifyError: org/apache/poi/xssf/usermodel/XSSFWorkbook
This is my Code (HSSFWorkbook Constructor is working btw):
Code:
Workbook workbook;
if (StringOperationsUtil.getFileExtension(file).equalsIgnoreCase("XLSX")){
workbook = new XSSFWorkbook();
} else {
//default xls
workbook = new HSSFWorkbook();
}
These are my gradle dependencies:
Code:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.opencsv:opencsv:3.4'
compile 'org.apache.poi:poi:3.12'
compile 'org.apache.poi:poi-ooxml:3.12'
compile 'com.android.support:multidex:1.0.0'
}
Also the apache team didn't answer me. I can't believe that it's not possible to create the newest excel file in an android application. Does really any Android Developer is not using xlsx files? I really can't believe this. Please let me know, if you guys know something about that issue.
Thanks in advance!
I tried to use the older poi.jar 3.8 and now i get this error:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
G:\android-sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --multi-dex --main-dex-list G:\Development\workspace\FPT\app\build\intermediates\multi-dex\debug\maindexlist.txt --output G:\Development\workspace\FPT\app\build\intermediates\dex\debug --input-list=G:\Development\workspace\FPT\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
1
does anybody know how i fix this?
thanks
Related
I am relatively new to programing and have been teaching myself as I go. I am trying to now integrate ESPN's API into my app which outputs XML data. I have done enough research to understand that I need to use an XML parser and that the XML can be displayed as a list view or web view by adding HTML markup.
I would like this thread to become a general discussion for all new developers on what XML parsing is and what it does. How it works, the code behind it etc.
I am currently trying to modify a code snippet from the developer.google.com website.
Android includes built in libraries for XML Parsing.
You can see a minimal use of the library here:
Code:
import java.io.IOException;
import java.io.StringReader;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
public class SimpleXmlPullApp
{
public static void main (String args[])
throws XmlPullParserException, IOException
{
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput( new StringReader ( "<foo>Hello World!</foo>" ) );
int eventType = xpp.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
if(eventType == XmlPullParser.START_DOCUMENT) {
System.out.println("Start document");
} else if(eventType == XmlPullParser.START_TAG) {
System.out.println("Start tag "+xpp.getName());
} else if(eventType == XmlPullParser.END_TAG) {
System.out.println("End tag "+xpp.getName());
} else if(eventType == XmlPullParser.TEXT) {
System.out.println("Text "+xpp.getText());
}
eventType = xpp.next();
}
System.out.println("End document");
}
}
So essentially, you can grab the xml from ESPN, save it to a file, parse it with that library, and output as desired.
Full details here: http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html
the fastest way I know is the parser written in c/c++ and compiled with ndk.
bitpushr said:
Android includes built in libraries for XML Parsing.
So essentially, you can grab the xml from ESPN, save it to a file, parse it with that library, and output as desired.
Full details here: http://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html
Click to expand...
Click to collapse
I will have to try out this code. Because I am learning as I go there are many things in java I don't yet understand which ultimately make it a lot harder to accomplish tasks but I am slowly catching on
If you want to do this in a .NET (Windows x86/64, Windows Mobile, Windows Phone) environment, or a Linux MONO environment then the following will carry out the bare minimum of parsing.
Assuming you have the data in an XML file :- PARAMS.XML in the same folder as the program, created similar to this:
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<PARAMS>
<Library>TESTLIB</Library>
<Source>C:\RetData\</Source>
</PARAMS>
Then the following C# code will read and extract the parameters:
Code:
using System.Xml;
string LibName,RetDir;
XmlReader xrdr = XmlReader.Create(Application.StartupPath+"\\PARAMS.xml");
xrdr.ReadToFollowing("Library");
Libname=xrdr.ReadElementContentAsString();
xrdr.ReadToFollowing("Source");
RetDir = xrdr.ReadElementContentAsString();
xrdr.Close();
After executing this code then:
LibName = "TESTLIB"
RetDir = "C:\RetData\"
CAVEAT:
I mentioned that this is the bare minimum. An XmlReader object is a forward only reader. Also, this code has no error checking.
In this case the elements must be read in the order they occur or the reader will encounter a null element and throw an error.
I know most of you don't expect me starting a thread in the Q&A but I am out of ideas. I googled, searched, duh, but found nothing that could be useful to me.
The problem is that the file attached is giving me an error.
Code:
target thumb C++: libstagefright <= frameworks/base/media/libstagefright/ACodec.cpp
In file included from frameworks/base/media/libstagefright/ACodec.cpp:42:
./vendor/qcom/opensource/omx/mm-core/omxcore/inc/OMX_QCOMExtns.h:846: warning: 'typedef' was ignored in this declaration
frameworks/base/media/libstagefright/ACodec.cpp:176: error: expected primary-expression before 'struct'
frameworks/base/media/libstagefright/ACodec.cpp:176: error: expected ',' or ';' before 'struct'
frameworks/base/media/libstagefright/ACodec.cpp:3041: error: expected '}' at end of input
make: *** [out/target/product/golfu/obj/SHARED_LIBRARIES/libstagefright_intermediates/ACodec.o] Error 1
I tried editing it in several ways for about 2 hours but it doesn't work.
I would really appreciate if someone would either link me to a working one/tell me where the error is/fix it and point out the error.
Im curious as to what causes the error.
Thanks :3
which rom are you building?
best if you do a repo sync
cybojenix said:
which rom are you building?
best if you do a repo sync
Click to expand...
Click to collapse
I am building Cyanogenmod 9.
I tried deleting the frameworks folder, where the error is and then re-repo sync, but to no avail. :T
And yeah, to my surprise I did try repo syncing. o.o
You are missing an } sine the compiler passes by the typedef thing. Also you are misssing an ; but most of the errors are from }. I'll look over the code and I'll chech for the misssing/wrong }.
Sent from my HTC Desire C using xda premium
That's what it says but I reviewed the file and did not find any errors. So any help would be appreciated :3
Bump
I hate reviving a dead thread, but I'm going through the same problem right now, building CM9, and I got the same Acodec.cpp errors. I also checked the file and it was written correctly. I'm not sure how to fix this, and could use some help from the community.
SignOfTheShadow said:
I hate reviving a dead thread, but I'm going through the same problem right now, building CM9, and I got the same Acodec.cpp errors. I also checked the file and it was written correctly. I'm not sure how to fix this, and could use some help from the community.
Click to expand...
Click to collapse
Looks like there was something missing in the struct typedef thing.
Try removing //QCOM_HARDWARE from line #172
bugkillr said:
Can you share the local code snippet on pastebin? Looks like there was something missing in the struct typedef thing.
Click to expand...
Click to collapse
I can't access PasteBin from work (they consider the text there to be "Personal Storage & Backup"), so the file in it's entirety is attached after pasting into a .txt file.
This is Line 176, mentioned in the error code, with 5 lines before and after:
Code:
#endif
#endif //QCOM_HARDWARE
////////////////////////////////////////////////////////////////////////////////
struct ACodec::BaseState : public AState {
BaseState(ACodec *codec, const sp<AState> &parentState = NULL);
protected:
enum PortMode {
KEEP_BUFFERS,
and this is line 3041, with 5 before (3041 is the last line):
Code:
LOGV("FlushingOutputState Change state to port settings changed");
mCodec->changeState(mCodec->mOutputPortSettingsChangedState);
}
}
#endif
} // namespace android
I'm totally lost as far as this file goes. I'm no good with C++... Thank you for taking an interest, I really do appreciate it. I messaged Nick Bacon (OP) and he gave me some suggestions, but nothing really panned out.
I removed "//QCOM_HARDWARE" from line 172 and am brunching as we speak. I'll edit with the results in a few.
EDIT: No good. Same error.
2nd EDIT: I added a ";" and two carriage returns before "struct" on line 176, and that seemed to just give me more errors:
Code:
target thumb C++: libstagefright <= frameworks/base/media/libstagefright/ACodec.cpp
In file included from frameworks/base/media/libstagefright/ACodec.cpp:42:
./vendor/qcom/opensource/omx/mm-core/omxcore/inc/OMX_QCOMExtns.h:846: warning: 'typedef' was ignored in this declaration
frameworks/base/media/libstagefright/ACodec.cpp:176: error: expected primary-expression before ';' token
frameworks/base/media/libstagefright/ACodec.cpp: In member function 'android::status_t android::ACodec::allocateOutputBuffersFromNativeWindow()':
frameworks/base/media/libstagefright/ACodec.cpp:537: warning: enumeral mismatch in conditional expression: '<anonymous enum>' vs 'OMX_COLOR_FORMATTYPE'
frameworks/base/media/libstagefright/ACodec.cpp: In member function 'void android::ACodec::sendFormatChange()':
frameworks/base/media/libstagefright/ACodec.cpp:1386: warning: enumeral mismatch in conditional expression: '<anonymous enum>' vs 'OMX_COLOR_FORMATTYPE'
make: *** [out/target/product/l35g/obj/SHARED_LIBRARIES/libstagefright_intermediates/ACodec.o] Error 1
SignOfTheShadow said:
I removed "//QCOM_HARDWARE" from line 172 and am brunching as we speak. I'll edit with the results in a few.
EDIT: No good. Same error.
2nd EDIT: I added a ";" and two carriage returns before "struct" on line 176, and that seemed to just give me more errors:
Code:
target thumb C++: libstagefright <= frameworks/base/media/libstagefright/ACodec.cpp
In file included from frameworks/base/media/libstagefright/ACodec.cpp:42:
./vendor/qcom/opensource/omx/mm-core/omxcore/inc/OMX_QCOMExtns.h:846: warning: 'typedef' was ignored in this declaration
frameworks/base/media/libstagefright/ACodec.cpp:176: error: expected primary-expression before ';' token
frameworks/base/media/libstagefright/ACodec.cpp: In member function 'android::status_t android::ACodec::allocateOutputBuffersFromNativeWindow()':
frameworks/base/media/libstagefright/ACodec.cpp:537: warning: enumeral mismatch in conditional expression: '<anonymous enum>' vs 'OMX_COLOR_FORMATTYPE'
frameworks/base/media/libstagefright/ACodec.cpp: In member function 'void android::ACodec::sendFormatChange()':
frameworks/base/media/libstagefright/ACodec.cpp:1386: warning: enumeral mismatch in conditional expression: '<anonymous enum>' vs 'OMX_COLOR_FORMATTYPE'
make: *** [out/target/product/l35g/obj/SHARED_LIBRARIES/libstagefright_intermediates/ACodec.o] Error 1
Click to expand...
Click to collapse
Well, I don't even have the libraries used in this code and its a large piece of code. So what I can suggest you is setting breakpoints and debugging in Eclipse or a good IDE. OR alternatively you can use gdb or valgrind to see extended flaws in the code. Because just rectifying the bugs in the code would definitely solve the issue.
bugkillr said:
Well, I don't even have the libraries used in this code and its a large piece of code. So what I can suggest you is setting breakpoints and debugging in Eclipse or a good IDE. OR alternatively you can use gdb or valgrind to see extended flaws in the code. Because just rectifying the bugs in the code would definitely solve the issue.
Click to expand...
Click to collapse
I ended up adding:
Code:
{};
to line 175 of the original file. It worked. Thanks for helping.
Are u saying u successfully built cm9??
Sent from my HTC Desire C using xda app-developers app
SignOfTheShadow said:
I ended up adding:
Code:
{};
to line 175 of the original file. It worked. Thanks for helping.
Click to expand...
Click to collapse
Never knew that would fix it! Congratulations btw.
This is very useful. Thanks for the solve. Gonna spam some thanks and request this thread to be closed.
Hi all.
I have developed few Xposed android modules in Eclipse and they are all were developed in the same worksapce.
During the development i have realized that i have common functionality between the modules and i decided to create a library with the common behavior where all other modules have to import this library to their build path.
The common library is called 'ModulesCommon' and it is using the Xposed API (HookMethod for example) . Additionally some of the modules them-self use the Xposed APIs.
What i have done in Eclipse is to add XposedBridgeApi.jar to the build path of ModulesCommon and to the build path of the modules that use Xposed API.
In the Build path menu of ModulesCommon and the modules i have navigated into the Build path menu to the tab of "Order and Export" and removed the export sign from XposedBridgeApi.jar .
Every thing worked fine but now i am trying to move the project to Android Studio.
I have created a new project and imported ModulesCommon library with one of the modules that uses Xposed API.
The dependencies block of ModulesCommon contains:
PHP:
dependencies {
provided files('lib/XposedBridgeApi.jar')
}
The dependencies block of the module contains:
PHP:
dependencies {
compile 'com.google.android.gms:play-services:6.5.87'
compile project(':modulesCommon' )
}
The module compiles and installed on the device but i keep getting the same error all the time:
PHP:
W/dalvikvm( 1933): Class resolved by unexpected DEX: Lcom/mol/locationreportmodule/GpsModule;(0x41d70e00):0x41a17000 ref [Lde/robv/android/xposed/IXposedHookLoadPackage;] Lde/robv/android/xposed/IXposedHookLoadPackage;(0x41ac9598):0x40006000
W/dalvikvm( 1933): (Lcom/mol/locationmodule/GpsModule; had used a different Lde/robv/android/xposed/IXposedHookLoadPackage; during pre-verification)
I/dalvikvm( 1933): Failed resolving Lcom/pol/locationmodule/GpsModule; interface 4712 'Lde/robv/android/xposed/IXposedHookLoadPackage;'
W/dalvikvm( 1933): Link of class 'Lcom/pol/locationmodule/GpsModule;' failed
Does anybody can help me to solve this dependency problem?
Thank you!
I am developing in Android Studio.
There is a problem though. When I change the code and I run the app it works fine, But when i change something in the layout it does not change until i do a clean project. e.g. i add a button and run the app, the button does not exist but when i do a clean project it is there...
Even Android studio shows an error when accessing the id of the newly added view...
Please help me solve this problem. Any help would be much appreciated.
Additional information:
-Android Studio version: 1.3.1
-Operating system: windows
-Gradle version: 2.6
I am having multiple directories as my resources with gradle like this:
Code:
sourceSets{
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java', '.apt_generated']
aidl.srcDirs = ['src/main/aidl', '.apt_generated']
res.srcDirs = [
'src/main/res',
'src/main/res/layouts/test',
'src/main/res/layouts/login',
'src/main/res/layouts/main',
'src/main/res/layouts/includes'
]
}
}
When i try to run the project with changed layout it says:
No apk changes detected. Skipping file upload, force stopping package instead.
DEVICE SHELL COMMAND: am force-stop com.my.package
Click to expand...
Click to collapse
saeednt said:
I am developing in Android Studio.
There is a problem though. When I change the code and I run the app it works fine, But when i change something in the layout it does not change until i do a clean project. e.g. i add a button and run the app, the button does not exist but when i do a clean project it is there...
Even Android studio shows an error when accessing the id of the newly added view...
Please help me solve this problem. Any help would be much appreciated.
Additional information:
-Android Studio version: 1.3.1
-Operating system: windows
-Gradle version: 2.6
I am having multiple directories as my resources with gradle like this:
Code:
sourceSets{
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java', '.apt_generated']
aidl.srcDirs = ['src/main/aidl', '.apt_generated']
res.srcDirs = [
'src/main/res',
'src/main/res/layouts/test',
'src/main/res/layouts/login',
'src/main/res/layouts/main',
'src/main/res/layouts/includes'
]
}
}
When i try to run the project with changed layout it says:
Click to expand...
Click to collapse
Look, there are couple of things you should see,
first when you make changes you should save it every time when you make changes in it
go over all the functions you created and make sure they are wire up correctly and they should not get separated when you make changes, App location can be a problem as well, go over from your code couple of times you will find out the issue because its in your hand
Hi, i have the next problem, when i open a project in android stuidio, appear the next message
Error:Could not create an instance of Tooling API implementation using the specified Gradle installation 'C:\Program Files\Android\Android Studio\gradle\gradle-2.8'.
what could be? and What i can do?
Thanks for all
Have you tried updating Android Studio?
Also you could show build.gradle file for this project.
klisiecki said:
Have you tried updating Android Studio?
Also you could show build.gradle file for this project.
Click to expand...
Click to collapse
this show the file build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Hi!
Try to use last version of android studio gradle plugin.
Just change line
Code:
classpath 'com.android.tools.build:gradle:1.5.0'
to
Code:
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'