Fixed
Status Update
Comments
fe...@gmail.com <fe...@gmail.com> #2
For the avoidance of doubt, if I create a function
function myFunction() {
Library.libFunction1();
}
and then run myFunction, that works fine.
function myFunction() {
Library.libFunction1();
}
and then run myFunction, that works fine.
xa...@android.com <xa...@android.com>
yr...@google.com <yr...@google.com> #3
Yes, libFunction1 - library function should be called directly from the menu, not from the upper level script. Currently it works in next way:
-----------LIB-----------
function libMenu() {
var mySheet = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "libFunction1", functionName: "Library.libFunction1"},
{name: "libFunction2", functionName: "libFunction1"}
];
mySheet.addMenu("Library Functions", menuEntries);
}
-----------LIB-----------
-----------CLIENT-----------
function onOpen() {
Library.libMenu();
}
function libFunction1() {
Library.libFunction1();
}
-----------CLIENT-----------
but client script should contain only onOpen function.
-----------LIB-----------
function libMenu() {
var mySheet = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "libFunction1", functionName: "Library.libFunction1"},
{name: "libFunction2", functionName: "libFunction1"}
];
mySheet.addMenu("Library Functions", menuEntries);
}
-----------LIB-----------
-----------CLIENT-----------
function onOpen() {
Library.libMenu();
}
function libFunction1() {
Library.libFunction1();
}
-----------CLIENT-----------
but client script should contain only onOpen function.
fe...@gmail.com <fe...@gmail.com> #4
[Comment deleted]
fe...@gmail.com <fe...@gmail.com> #5
When you plan to fix it? It's very important issue. Thanks.
fe...@gmail.com <fe...@gmail.com> #6
This is a big inconvenience, especially when you deploy a library that create a menu Ui. Would be great if this could be fixed. Regards,
fe...@gmail.com <fe...@gmail.com> #7
Please fix!
br...@gmail.com <br...@gmail.com> #8
Yes, a big inconvenience. One way to circumvent it could be to call a master libfuntion in the client, with a parameter:
function libFunction1(menuitem) {
Library.libFunction1(menuitem);
}
but... menuitems do not accept parameters.
So, my second choice will be to populate my client script (which should ideally only contain onOpen) with a number of "generic" menu function triggers, some of them just sitting there, ready for future expansions, hopefully enough so that I will never have to alter the client script when i expand the library with more menu items, and at the same time not having misleading names (not descriptive either, unfortunately):
function libFunction1() {
Library.libFunction1();
}
function libFunction2() {
Library.libFunction2();
}
...
function libFunction20() {
Library.libFunction20();
}
function libFunction1(menuitem) {
Library.libFunction1(menuitem);
}
but... menuitems do not accept parameters.
So, my second choice will be to populate my client script (which should ideally only contain onOpen) with a number of "generic" menu function triggers, some of them just sitting there, ready for future expansions, hopefully enough so that I will never have to alter the client script when i expand the library with more menu items, and at the same time not having misleading names (not descriptive either, unfortunately):
function libFunction1() {
Library.libFunction1();
}
function libFunction2() {
Library.libFunction2();
}
...
function libFunction20() {
Library.libFunction20();
}
fe...@gmail.com <fe...@gmail.com> #9
Instead of passing a functionName, why not passing the function itself?
e.g.,
-----------LIB-----------
function libMenu() {
var mySheet = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "menuItem1", handler: menuItem1},
{name: "libFunction2", handler: function() {menuItem2(3);}}
];
mySheet.addMenu("Library Functions", menuEntries);
}
function menuItem1() {
}
function menuItem2(someArg) {
}
-----------LIB-----------
-----------CLIENT-----------
function onOpen() {
Library.libMenu();
}
-----------CLIENT-----------
e.g.,
-----------LIB-----------
function libMenu() {
var mySheet = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [ {name: "menuItem1", handler: menuItem1},
{name: "libFunction2", handler: function() {menuItem2(3);}}
];
mySheet.addMenu("Library Functions", menuEntries);
}
function menuItem1() {
}
function menuItem2(someArg) {
}
-----------LIB-----------
-----------CLIENT-----------
function onOpen() {
Library.libMenu();
}
-----------CLIENT-----------
fe...@gmail.com <fe...@gmail.com> #10
Without this feature, libraries are really nobbled!
+1 for passing the function itself!
+1 for passing the function itself!
fe...@gmail.com <fe...@gmail.com> #12
Please Fix it.
fe...@gmail.com <fe...@gmail.com> #13
I actually thought cooledco's suggestion was a current solution to the problem, but alas it is just a suggestion to how a possible solution might be implemented.
+1 for the idea though. This passing of function "names" seems very old skool!?
+1 for the idea though. This passing of function "names" seems very old skool!?
fe...@gmail.com <fe...@gmail.com> #14
I just ran into this as I'm upgrading a script used by many spreadsheets (that I don't necessarily have access to).
What I'm planning is this:
1. Create a new Upgrade menu
2. Upgrade menu item will run onEdit with no argument
3. onEdit calls library's onEdit
4. Library's onEdit, when it sees no argument passed to it will know the user is trying to upgrade and offer instructions to copy and paste new code.
4. New code will contain lots of generic function names for the future to avoid this happening again as longer as possible.
What I'm planning is this:
1. Create a new Upgrade menu
2. Upgrade menu item will run onEdit with no argument
3. onEdit calls library's onEdit
4. Library's onEdit, when it sees no argument passed to it will know the user is trying to upgrade and offer instructions to copy and paste new code.
4. New code will contain lots of generic function names for the future to avoid this happening again as longer as possible.
ni...@gmail.com <ni...@gmail.com> #15
Unassigning
ma...@gmail.com <ma...@gmail.com> #16
A year later and this has been ignored?? What is the point of having a global library if you have to write a freaking wrapper for it each time?! The mind boggles. Please fix this, it should be callable from both the spreadsheet cells AND any buttons (images -> via assign script) on the spreadsheet that has the library included.
ni...@gmail.com <ni...@gmail.com> #17
I, too, have been forced to constantly edit my client scripts any time I want to make changes to the Library. I came across this post as I was looking for a solution, but it looks like there really is no convenient solution at the moment. That would be very nice if there were.
+1 for calling a library function directly from the menu
+1 for calling a library function directly from the menu
fe...@gmail.com <fe...@gmail.com> #18
to me works SpreadsheetApp.getUi().createMenu('MenuName').addItem('ItemName', 'Library.libFunction1').addToUi();
ni...@gmail.com <ni...@gmail.com> #19
Here is a workaround that allows you to call any library function if you paste in this one generic wrapper function. Then you can call this from the spreadsheet.
For example, if I had a library called MyLib with a function add(x, y) (pretend x is in cell A1 and y is in cell A2) I could call it like this:
=LIB_FUNC("MyLib", "add", A1, A2).
It's a little ugly but at least allows me to only have to paste this one function and then access any library function. Note that this depends on undocumented structure of the "this" object that is in scope when calling the wrapper function. Small chance this could break over time. Might see if I can publish this as an add on.
function LIB_FUNC(libraryName, functionName) {
var result;
var lib = this[libraryName];
var extraArgs = [];
if (lib) {
var func = lib[functionName];
if (func) {
if (arguments.length > 2) {
extraArgs = Array.apply(null, arguments).slice(2);
}
result = func.apply(this, extraArgs);
} else {
throw "No such function: " + functionName;
}
} else {
throw "No such library: " + libraryName;
}
return result;
}
For example, if I had a library called MyLib with a function add(x, y) (pretend x is in cell A1 and y is in cell A2) I could call it like this:
=LIB_FUNC("MyLib", "add", A1, A2).
It's a little ugly but at least allows me to only have to paste this one function and then access any library function. Note that this depends on undocumented structure of the "this" object that is in scope when calling the wrapper function. Small chance this could break over time. Might see if I can publish this as an add on.
function LIB_FUNC(libraryName, functionName) {
var result;
var lib = this[libraryName];
var extraArgs = [];
if (lib) {
var func = lib[functionName];
if (func) {
if (arguments.length > 2) {
extraArgs = Array.apply(null, arguments).slice(2);
}
result = func.apply(this, extraArgs);
} else {
throw "No such function: " + functionName;
}
} else {
throw "No such library: " + libraryName;
}
return result;
}
ni...@gmail.com <ni...@gmail.com> #20
Just in case people are still looking for solutions.
function TESTF() {
return myLib.TESTF.apply(null,arguments);
}
Can be applied in a for loop for every method on myLib.. I use this in all of my scripts so I just have a 5 line script in the document, add the library, and walah, the library is directly part of this script as if I was "using namespace myLib;"
[edit] Also, this means that spreadsheets can call those functions as well as if they were actually written in this script.
Hope it helps.
function TESTF() {
return myLib.TESTF.apply(null,arguments);
}
Can be applied in a for loop for every method on myLib.. I use this in all of my scripts so I just have a 5 line script in the document, add the library, and walah, the library is directly part of this script as if I was "using namespace myLib;"
[edit] Also, this means that spreadsheets can call those functions as well as if they were actually written in this script.
Hope it helps.
ni...@gmail.com <ni...@gmail.com> #21
Comment 20 explanation is a little opaque to me. Can anyone elaborate?
Seems silly that library functions aren't exposed to the documents once included. Makes them somewhat pointless if a wrapper must be included in every document, or unless #20 is on to something with a generic 5 line wrapper.
Seems silly that library functions aren't exposed to the documents once included. Makes them somewhat pointless if a wrapper must be included in every document, or unless #20 is on to something with a generic 5 line wrapper.
yr...@google.com <yr...@google.com> #22
I am also interested in a deeper explanation of comment #20
I understand she/he meants using a loop to navigate all methods in library, in order to easily define a new function inside the sheet-bounded-script for each library method.
But, how can we loop every method on the library? And how can we define a new function inside that loop, which takes its name from the library?
I understand she/he meants using a loop to navigate all methods in library, in order to easily define a new function inside the sheet-bounded-script for each library method.
But, how can we loop every method on the library? And how can we define a new function inside that loop, which takes its name from the library?
fe...@gmail.com <fe...@gmail.com> #23
same here, please explain if possible !
yr...@google.com <yr...@google.com> #24
As far as I can tell, calling library functions from menus as in SpreadsheetApp.getUi().createMenu('MenuName').addItem('ItemName', 'Library.libFunction1').addToUi() has been supported since 2013. I don't see any additional work that needs to be done here.
ni...@gmail.com <ni...@gmail.com> #25
Judging by the comments in the thread, I believe the expectation is that functions in a Library could be called from not only a menu item, but also from the Sheet's own script, and even directly from a formula entered in a cell, just like any other function local to the Sheet's script would be called, only difference being that the referred function would be in the Library.
ni...@gmail.com <ni...@gmail.com> #26
Ok I have good news :)
I succeeded in reproducing the bug on a test project (in attachment).
Import it in Android studio, and run the class TestBugReplicator (from androidTest), with the Runner "com.testbug.DexInstrumentation".
You'll get the error. (at least I have)
I tried to make the project as little/simple as I could.
Thank you !
BTW : I use OS X Yosemite 10.10 on a Macbook Air.
I succeeded in reproducing the bug on a test project (in attachment).
Import it in Android studio, and run the class TestBugReplicator (from androidTest), with the Runner "com.testbug.DexInstrumentation".
You'll get the error. (at least I have)
I tried to make the project as little/simple as I could.
Thank you !
BTW : I use OS X Yosemite 10.10 on a Macbook Air.
yr...@google.com <yr...@google.com> #27
So if you have no duplicate this does not look like a packaging issue any more. Can you please tell me which device + android version you used to run the test?
Thank you for the reproduction project, I'll try it soon.
Thank you for the reproduction project, I'll try it soon.
ni...@gmail.com <ni...@gmail.com> #28
I used my Galaxy S5 on Android 4.4.2, and an automatically created emulator (using Jenkins) on 4.4.4 too. Same on a Genymotion VM, and a Nexus 4 (4.4.4).
yr...@google.com <yr...@google.com> #29
I was not able to reproduce directly with the given project. Anyway I managed to force it in the attached apk with a simpler test class (source attached too), force the rest of the test I kept the given project just playing with manifest and packaging to force classes partition.
Unfortunately I don't understand what's exactly happening into Dalvik.
Brian, I'm assigning to you hoping you'll be able to explain me why Dalvik is complaining there.
To reproduce, just do:
adb shell am instrument -w -r -e debug false com.testbug/com.testbug.DexInstrumentation
and you'll see in the logcat:
W/dalvikvm( 6671): Class resolved by unexpected DEX: Lcom/testbug/ResponseWeather;(0x4137c748):0x50c55000 ref [Lcom/fasterxml/jackson/annotation/JsonInclude$Include;] Lcom/fasterxml/jackson/annotation/JsonInclude$Include;(0x4137c748):0x4deff000
W/dalvikvm( 6671): (Lcom/testbug/ResponseWeather; had used a different Lcom/fasterxml/jackson/annotation/JsonInclude$Include; during pre-verification)
D/dalvikvm( 6671): threadid=11: still suspended after undo (sc=1 dc=1)
W/dalvikvm( 6671): Failed processing annotation value
I/TestRunner( 6671): failed: testAnnotation(com.testbug.TestBugReplicator)
I/TestRunner( 6671): ----- begin exception -----
I/TestRunner( 6671):
I/TestRunner( 6671): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
I/TestRunner( 6671): at java.lang.Class.getDeclaredAnnotations(Native Method)
I/TestRunner( 6671): at java.lang.Class.getAnnotations(Class.java:297)
I/TestRunner( 6671): at com.testbug.TestBugReplicator.testAnnotation(TestBugReplicator.java:14)
I/TestRunner( 6671): at java.lang.reflect.Method.invokeNative(Native Method)
I/TestRunner( 6671): at java.lang.reflect.Method.invoke(Method.java:511)
I/TestRunner( 6671): at junit.framework.TestCase.runTest(TestCase.java:168)
I/TestRunner( 6671): at junit.framework.TestCase.runBare(TestCase.java:134)
I/TestRunner( 6671): at junit.framework.TestResult$1.protect(TestResult.java:115)
I/TestRunner( 6671): at junit.framework.TestResult.runProtected(TestResult.java:133)
I/TestRunner( 6671): at junit.framework.TestResult.run(TestResult.java:118)
I/TestRunner( 6671): at junit.framework.TestCase.run(TestCase.java:124)
I/TestRunner( 6671): at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
I/TestRunner( 6671): at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
I/TestRunner( 6671): at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
I/TestRunner( 6671): at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
I/TestRunner( 6671): ----- end exception -----
I didn't manage to reproduce on the simpler cases I tried.
At first I suspected dvmResolveClass bug or called with the wrong fromUnverifiedConstant value. But it's maybe more complicated than that.
Unfortunately I don't understand what's exactly happening into Dalvik.
Brian, I'm assigning to you hoping you'll be able to explain me why Dalvik is complaining there.
To reproduce, just do:
adb shell am instrument -w -r -e debug false com.testbug/com.testbug.DexInstrumentation
and you'll see in the logcat:
W/dalvikvm( 6671): Class resolved by unexpected DEX: Lcom/testbug/ResponseWeather;(0x4137c748):0x50c55000 ref [Lcom/fasterxml/jackson/annotation/JsonInclude$Include;] Lcom/fasterxml/jackson/annotation/JsonInclude$Include;(0x4137c748):0x4deff000
W/dalvikvm( 6671): (Lcom/testbug/ResponseWeather; had used a different Lcom/fasterxml/jackson/annotation/JsonInclude$Include; during pre-verification)
D/dalvikvm( 6671): threadid=11: still suspended after undo (sc=1 dc=1)
W/dalvikvm( 6671): Failed processing annotation value
I/TestRunner( 6671): failed: testAnnotation(com.testbug.TestBugReplicator)
I/TestRunner( 6671): ----- begin exception -----
I/TestRunner( 6671):
I/TestRunner( 6671): java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
I/TestRunner( 6671): at java.lang.Class.getDeclaredAnnotations(Native Method)
I/TestRunner( 6671): at java.lang.Class.getAnnotations(Class.java:297)
I/TestRunner( 6671): at com.testbug.TestBugReplicator.testAnnotation(TestBugReplicator.java:14)
I/TestRunner( 6671): at java.lang.reflect.Method.invokeNative(Native Method)
I/TestRunner( 6671): at java.lang.reflect.Method.invoke(Method.java:511)
I/TestRunner( 6671): at junit.framework.TestCase.runTest(TestCase.java:168)
I/TestRunner( 6671): at junit.framework.TestCase.runBare(TestCase.java:134)
I/TestRunner( 6671): at junit.framework.TestResult$1.protect(TestResult.java:115)
I/TestRunner( 6671): at junit.framework.TestResult.runProtected(TestResult.java:133)
I/TestRunner( 6671): at junit.framework.TestResult.run(TestResult.java:118)
I/TestRunner( 6671): at junit.framework.TestCase.run(TestCase.java:124)
I/TestRunner( 6671): at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
I/TestRunner( 6671): at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
I/TestRunner( 6671): at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
I/TestRunner( 6671): at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
I/TestRunner( 6671): ----- end exception -----
I didn't manage to reproduce on the simpler cases I tried.
At first I suspected dvmResolveClass bug or called with the wrong fromUnverifiedConstant value. But it's maybe more complicated than that.
ka...@gmail.com <ka...@gmail.com> #30
Sorry for my english)
I faced the same exception. Here is log:
W/dalvikvm﹕ Class resolved by unexpected DEX: Lcom/myproject/core/data/item/ItemPrice;(0x427b9f70):0x58002000 ref [Lcom/j256/ormlite/field/DataType;] Lcom/j256/ormlite/field/DataType;(0x427b9f70):0x596cf000
11-10 16:30:20.764 25799-26287/com.myproject W/dalvikvm﹕ (Lcom/myproject/core/data/item/ItemPrice; had used a different Lcom/j256/ormlite/field/DataType; during pre-verification)
11-10 16:30:20.764 25799-26287/com.myproject W/dalvikvm﹕ Failed processing annotation value
11-10 16:30:20.764 25799-26287/com.myproject D/dalvikvm﹕ Failed creating an annotation
11-10 16:30:20.764 25799-26287/com.myproject W/dalvikvm﹕ threadid=15: thread exiting with uncaught exception (group=0x41d5c700)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at java.lang.reflect.Field.getDeclaredAnnotations(Native Method)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:204)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.AnnotatedClass._constructField(AnnotatedClass.java:808)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.AnnotatedClass._findFields(AnnotatedClass.java:688)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.AnnotatedClass.resolveFields(AnnotatedClass.java:462)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.AnnotatedClass.fields(AnnotatedClass.java:274)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addFields(POJOPropertiesCollector.java:363)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collect(POJOPropertiesCollector.java:232)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.collectProperties(BasicClassIntrospector.java:142)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forDeserialization(BasicClassIntrospector.java:81)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forDeserialization(BasicClassIntrospector.java:11)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.DeserializationConfig.introspect(DeserializationConfig.java:507)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:329)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:267)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:305)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.std.StdDeserializer.findDeserializer(StdDeserializer.java:634)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:438)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:298)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:322)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.ObjectReader._prefetchRootDeserializer(ObjectReader.java:1351)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.ObjectReader.<init>(ObjectReader.java:186)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:2445)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:2455)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.parseItemsArray(ItemListDownloadOperation.java:344)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.parseResult(ItemListDownloadOperation.java:319)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.downloadBinaryFile(ItemListDownloadOperation.java:231)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation.simpleHTTPconnectionProcessing(BaseDownloadOperation.java:243)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation.access$000(BaseDownloadOperation.java:38)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation$1.run(BaseDownloadOperation.java:90)
11-10 16:30:20.829 25799-26287/com.myproject E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-5068
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
at java.lang.reflect.Field.getDeclaredAnnotations(Native Method)
at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:204)
at com.fasterxml.jackson.databind.introspect.AnnotatedClass._constructField(AnnotatedClass.java:808)
at com.fasterxml.jackson.databind.introspect.AnnotatedClass._findFields(AnnotatedClass.java:688)
at com.fasterxml.jackson.databind.introspect.AnnotatedClass.resolveFields(AnnotatedClass.java:462)
at com.fasterxml.jackson.databind.introspect.AnnotatedClass.fields(AnnotatedClass.java:274)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addFields(POJOPropertiesCollector.java:363)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collect(POJOPropertiesCollector.java:232)
at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.collectProperties(BasicClassIntrospector.java:142)
at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forDeserialization(BasicClassIntrospector.java:81)
at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forDeserialization(BasicClassIntrospector.java:11)
at com.fasterxml.jackson.databind.DeserializationConfig.introspect(DeserializationConfig.java:507)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:329)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:267)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247)
at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146)
at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:305)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.findDeserializer(StdDeserializer.java:634)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:438)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:298)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247)
at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146)
at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:322)
at com.fasterxml.jackson.databind.ObjectReader._prefetchRootDeserializer(ObjectReader.java:1351)
at com.fasterxml.jackson.databind.ObjectReader.<init>(ObjectReader.java:186)
at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:2445)
at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:2455)
at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.parseItemsArray(ItemListDownloadOperation.java:344)
at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.parseResult(ItemListDownloadOperation.java:319)
at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.downloadBinaryFile(ItemListDownloadOperation.java:231)
at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation.simpleHTTPconnectionProcessing(BaseDownloadOperation.java:243)
at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation.access$000(BaseDownloadOperation.java:38)
at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation$1.run(BaseDownloadOperation.java:90)
I have added many libraries in my project and use multiDexEnabled = true in gradle. Also I added play services:
compile 'com.google.android.gms:play-services:6.1.71'
In this configuration application crashes every time it try to get annotations of some class field. It crashes when ormlite library, Jackson or my code try to get field annotations. Quick and ugly solution in this situation - change the version of play services:
compile 'com.google.android.gms:play-services:4.4.52'
With this version application run without this sort of crash. Could anyone suggest smth better??
I faced the same exception. Here is log:
W/dalvikvm﹕ Class resolved by unexpected DEX: Lcom/myproject/core/data/item/ItemPrice;(0x427b9f70):0x58002000 ref [Lcom/j256/ormlite/field/DataType;] Lcom/j256/ormlite/field/DataType;(0x427b9f70):0x596cf000
11-10 16:30:20.764 25799-26287/com.myproject W/dalvikvm﹕ (Lcom/myproject/core/data/item/ItemPrice; had used a different Lcom/j256/ormlite/field/DataType; during pre-verification)
11-10 16:30:20.764 25799-26287/com.myproject W/dalvikvm﹕ Failed processing annotation value
11-10 16:30:20.764 25799-26287/com.myproject D/dalvikvm﹕ Failed creating an annotation
11-10 16:30:20.764 25799-26287/com.myproject W/dalvikvm﹕ threadid=15: thread exiting with uncaught exception (group=0x41d5c700)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at java.lang.reflect.Field.getDeclaredAnnotations(Native Method)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:204)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.AnnotatedClass._constructField(AnnotatedClass.java:808)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.AnnotatedClass._findFields(AnnotatedClass.java:688)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.AnnotatedClass.resolveFields(AnnotatedClass.java:462)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.AnnotatedClass.fields(AnnotatedClass.java:274)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addFields(POJOPropertiesCollector.java:363)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collect(POJOPropertiesCollector.java:232)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.collectProperties(BasicClassIntrospector.java:142)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forDeserialization(BasicClassIntrospector.java:81)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forDeserialization(BasicClassIntrospector.java:11)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.DeserializationConfig.introspect(DeserializationConfig.java:507)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:329)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:267)
11-10 16:30:20.779 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:305)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.std.StdDeserializer.findDeserializer(StdDeserializer.java:634)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:438)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:298)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146)
11-10 16:30:20.784 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:322)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.ObjectReader._prefetchRootDeserializer(ObjectReader.java:1351)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.ObjectReader.<init>(ObjectReader.java:186)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:2445)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:2455)
11-10 16:30:20.789 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.parseItemsArray(ItemListDownloadOperation.java:344)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.parseResult(ItemListDownloadOperation.java:319)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.downloadBinaryFile(ItemListDownloadOperation.java:231)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation.simpleHTTPconnectionProcessing(BaseDownloadOperation.java:243)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation.access$000(BaseDownloadOperation.java:38)
11-10 16:30:20.794 25799-26287/com.myproject W/System.err﹕ at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation$1.run(BaseDownloadOperation.java:90)
11-10 16:30:20.829 25799-26287/com.myproject E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-5068
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
at java.lang.reflect.Field.getDeclaredAnnotations(Native Method)
at java.lang.reflect.Field.getDeclaredAnnotations(Field.java:204)
at com.fasterxml.jackson.databind.introspect.AnnotatedClass._constructField(AnnotatedClass.java:808)
at com.fasterxml.jackson.databind.introspect.AnnotatedClass._findFields(AnnotatedClass.java:688)
at com.fasterxml.jackson.databind.introspect.AnnotatedClass.resolveFields(AnnotatedClass.java:462)
at com.fasterxml.jackson.databind.introspect.AnnotatedClass.fields(AnnotatedClass.java:274)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector._addFields(POJOPropertiesCollector.java:363)
at com.fasterxml.jackson.databind.introspect.POJOPropertiesCollector.collect(POJOPropertiesCollector.java:232)
at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.collectProperties(BasicClassIntrospector.java:142)
at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forDeserialization(BasicClassIntrospector.java:81)
at com.fasterxml.jackson.databind.introspect.BasicClassIntrospector.forDeserialization(BasicClassIntrospector.java:11)
at com.fasterxml.jackson.databind.DeserializationConfig.introspect(DeserializationConfig.java:507)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:329)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:267)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247)
at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146)
at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:305)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.findDeserializer(StdDeserializer.java:634)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:438)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:298)
at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:247)
at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:146)
at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:322)
at com.fasterxml.jackson.databind.ObjectReader._prefetchRootDeserializer(ObjectReader.java:1351)
at com.fasterxml.jackson.databind.ObjectReader.<init>(ObjectReader.java:186)
at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:2445)
at com.fasterxml.jackson.databind.ObjectMapper.reader(ObjectMapper.java:2455)
at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.parseItemsArray(ItemListDownloadOperation.java:344)
at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.parseResult(ItemListDownloadOperation.java:319)
at com.myproject.core.downloading.downloadOperations.ItemListDownloadOperation.downloadBinaryFile(ItemListDownloadOperation.java:231)
at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation.simpleHTTPconnectionProcessing(BaseDownloadOperation.java:243)
at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation.access$000(BaseDownloadOperation.java:38)
at com.myproject.core.downloading.downloadOperations.BaseDownloadOperation$1.run(BaseDownloadOperation.java:90)
I have added many libraries in my project and use multiDexEnabled = true in gradle. Also I added play services:
compile 'com.google.android.gms:play-services:6.1.71'
In this configuration application crashes every time it try to get annotations of some class field. It crashes when ormlite library, Jackson or my code try to get field annotations. Quick and ugly solution in this situation - change the version of play services:
compile 'com.google.android.gms:play-services:4.4.52'
With this version application run without this sort of crash. Could anyone suggest smth better??
sh...@google.com <sh...@google.com> #31
Attaching with gdb on a KK device (Nexus 4) when the exception is about to be thrown, we get the following stack:
Breakpoint 1, dvmThrowIllegalAccessError (msg=0x416237ad "Class ref in pre-verified class resolved to unexpected implementation") at dalvik/vm/Exception.cpp:1319
1319 void dvmThrowIllegalAccessError(const char* msg) {
(gdb) bt
#0 dvmThrowIllegalAccessError (msg=0x416237ad "Class ref in pre-verified class resolved to unexpected implementation") at dalvik/vm/Exception.cpp:1319
#1 0x415f15d8 in dvmResolveClass (referrer=0x41f461a0, classIdx=1065, fromUnverifiedConstant=fromUnverifiedConstant@entry=false) at dalvik/vm/oo/Resolve.cpp:138
#2 0x415f1672 in dvmResolveStaticField (referrer=<optimized out>, sfieldIdx=2127) at dalvik/vm/oo/Resolve.cpp:463
#3 0x415f217e in processAnnotationValue (clazz=clazz@entry=0x41f461a0, pPtr=pPtr@entry=0x75dbd9e4, pValue=pValue@entry=0x75dbd9f8, resultStyle=resultStyle@entry=kAllObjects) at dalvik/vm/reflect/Annotation.cpp:463
#4 0x415f234e in createAnnotationMember (pPtr=0x75dbd9e4, annoClass=<optimized out>, clazz=0x41f461a0) at dalvik/vm/reflect/Annotation.cpp:662
#5 processEncodedAnnotation (clazz=clazz@entry=0x41f461a0, pPtr=pPtr@entry=0x75dbda34) at dalvik/vm/reflect/Annotation.cpp:790
#6 0x415f267e in processAnnotationSet (clazz=0x41f461a0, pAnnoSet=0x752f4530, visibility=1) at dalvik/vm/reflect/Annotation.cpp:865
#7 0x415ebf2a in Dalvik_java_lang_Class_getDeclaredAnnotations (args=<optimized out>, pResult=0x75021a00) at dalvik/vm/native/java_lang_Class.cpp:711
#8 0x415d4aca in dvmResolveNativeMethod (args=0x75b92d70, pResult=0x75021a00, method=0x6d4f61e8, self=0x750219f0) at dalvik/vm/Native.cpp:106
#9 0x415ac028 in dalvik_mterp () at dalvik/vm/mterp/out/InterpAsm-armv7-a-neon.S:16267
#10 0x750219f0 in ?? ()
#11 0x750219f0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
Breakpoint 1, dvmThrowIllegalAccessError (msg=0x416237ad "Class ref in pre-verified class resolved to unexpected implementation") at dalvik/vm/Exception.cpp:1319
1319 void dvmThrowIllegalAccessError(const char* msg) {
(gdb) bt
#0 dvmThrowIllegalAccessError (msg=0x416237ad "Class ref in pre-verified class resolved to unexpected implementation") at dalvik/vm/Exception.cpp:1319
#1 0x415f15d8 in dvmResolveClass (referrer=0x41f461a0, classIdx=1065, fromUnverifiedConstant=fromUnverifiedConstant@entry=false) at dalvik/vm/oo/Resolve.cpp:138
#2 0x415f1672 in dvmResolveStaticField (referrer=<optimized out>, sfieldIdx=2127) at dalvik/vm/oo/Resolve.cpp:463
#3 0x415f217e in processAnnotationValue (clazz=clazz@entry=0x41f461a0, pPtr=pPtr@entry=0x75dbd9e4, pValue=pValue@entry=0x75dbd9f8, resultStyle=resultStyle@entry=kAllObjects) at dalvik/vm/reflect/Annotation.cpp:463
#4 0x415f234e in createAnnotationMember (pPtr=0x75dbd9e4, annoClass=<optimized out>, clazz=0x41f461a0) at dalvik/vm/reflect/Annotation.cpp:662
#5 processEncodedAnnotation (clazz=clazz@entry=0x41f461a0, pPtr=pPtr@entry=0x75dbda34) at dalvik/vm/reflect/Annotation.cpp:790
#6 0x415f267e in processAnnotationSet (clazz=0x41f461a0, pAnnoSet=0x752f4530, visibility=1) at dalvik/vm/reflect/Annotation.cpp:865
#7 0x415ebf2a in Dalvik_java_lang_Class_getDeclaredAnnotations (args=<optimized out>, pResult=0x75021a00) at dalvik/vm/native/java_lang_Class.cpp:711
#8 0x415d4aca in dvmResolveNativeMethod (args=0x75b92d70, pResult=0x75021a00, method=0x6d4f61e8, self=0x750219f0) at dalvik/vm/Native.cpp:106
#9 0x415ac028 in dalvik_mterp () at dalvik/vm/mterp/out/InterpAsm-armv7-a-neon.S:16267
#10 0x750219f0 in ?? ()
#11 0x750219f0 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
yr...@google.com <yr...@google.com> #32
Thanks Seb.
The stack points that processAnnotationValue is calling dvmResolveStaticField which calls "dvmResolveClass(..., ..., false)" the "false" argument in the context of an annotation value is wrong because dexopt does not treat annotation values.
This means:
1) You don't need multidex to face the problem.
2) To not face the problem we must ensure that enum referenced by runtime visible annotations are in the bootclasspath, or are in the same dex as the annotated classes.
The stack points that processAnnotationValue is calling dvmResolveStaticField which calls "dvmResolveClass(..., ..., false)" the "false" argument in the context of an annotation value is wrong because dexopt does not treat annotation values.
This means:
1) You don't need multidex to face the problem.
2) To not face the problem we must ensure that enum referenced by runtime visible annotations are in the bootclasspath, or are in the same dex as the annotated classes.
ka...@gmail.com <ka...@gmail.com> #33
How to ensure that visible annotations are in the same dex as the annotated classes?
bd...@google.com <bd...@google.com> #34
So it sounds like the partitioning needs to take annotations into account?
fe...@gmail.com <fe...@gmail.com> #35
That's what the dexMainClasses script was for, right? Our problems diminished when we used it to generate the classlist for the first dex, but the script was far from perfect and forced bad maintenance practices.
yr...@google.com <yr...@google.com> #36
#36 The dex of the annotation definition doesn't matter, it's the dex defining the enum that matters.
The current rule is putting all annotations + their direct references into the main dex so the fix is to keep all the class annotated by this kind of annotation in the main dex. If you really need something before a fix to the rule is delivered, you'll have to handle that manually. I don't think the gradle rule already allows to specify manual contribution to the main dex classes list, so one solution would be to build the dex files directly from dx command line and add manually the annotated classes to the list. Another workaround solution would be to add direct references (for example field with declared type of the annotated class :-( ) in an Application, Activity, Service...
#37 #38 Yes, I'm working on fixing that.
The current rule is putting all annotations + their direct references into the main dex so the fix is to keep all the class annotated by this kind of annotation in the main dex. If you really need something before a fix to the rule is delivered, you'll have to handle that manually. I don't think the gradle rule already allows to specify manual contribution to the main dex classes list, so one solution would be to build the dex files directly from dx command line and add manually the annotated classes to the list. Another workaround solution would be to add direct references (for example field with declared type of the annotated class :-( ) in an Application, Activity, Service...
#37 #38 Yes, I'm working on fixing that.
xa...@android.com <xa...@android.com> #38
@40, multiDexEnabled should do the same as manually calling mainDexClasses[.bat] and sending the output to dx.
We can actually do more optimization in Gradle, so it's better to let gradle do this.
There seems to be some issues though obviously. I'm interested if we can figure out what difference you see in the main class list using Gradle or the manual script.
We can actually do more optimization in Gradle, so it's better to let gradle do this.
There seems to be some issues though obviously. I'm interested if we can figure out what difference you see in the main class list using Gradle or the manual script.
fe...@gmail.com <fe...@gmail.com> #39
At least you can manually add failing classes to the script one by one, no other difference.
fe...@gmail.com <fe...@gmail.com> #40
That helped solving other problems like anon classes that were part of the Application class and were not being added consistently.
ni...@gmail.com <ni...@gmail.com> #41
[Comment deleted]
ni...@gmail.com <ni...@gmail.com> #42
[Comment deleted]
yr...@google.com <yr...@google.com> #43
#45 This does not look to be the same kind of problem, could you please open a new bug for this? Please add in which dex the missing class can be found. You can find it by unzipping your apk to a folder and then run in the folder:
for f in `ls classes*.dex`;
do
dexdump $f | sed -e s/^/$f:/ | grep " Class descriptor : " | grep "Lretrofit/Endpoints;"
done
Thank you.
for f in `ls classes*.dex`;
do
dexdump $f | sed -e s/^/$f:/ | grep " Class descriptor : " | grep "Lretrofit/Endpoints;"
done
Thank you.
yr...@google.com <yr...@google.com> #45
fe...@gmail.com <fe...@gmail.com> #46
Awesome! Thank you for the fix. Updating.
ni...@gmail.com <ni...@gmail.com> #47
I tried it a few minutes ago and it seems to work.
Great job !
Great job !
Description
Since this change was made and we've starting adding new libraries like appcompat_v7, we've seen on and off errors when trying to access java.lang.reflect.Field.getDeclaredAnnotations with other libraries like orm-lite or jackson.
java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
at java.lang.reflect.Field.getAnnotation(Native Method)
at java.lang.reflect.Field.getAnnotation(Field.java:209)
at com.j256.ormlite.field.DatabaseFieldConfig.fromField(DatabaseFieldConfig.java:512)
at com.j256.ormlite.android.DatabaseTableConfigUtil.configFromField(DatabaseTableConfigUtil.java:236)
at com.j256.ormlite.android.DatabaseTableConfigUtil.fromClass(DatabaseTableConfigUtil.java:50)
at com.j256.ormlite.db.SqliteAndroidDatabaseType.extractDatabaseTableConfig(SqliteAndroidDatabaseType.java:76)
at com.j256.ormlite.dao.DaoManager.createDao(DaoManager.java:67)
at com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper.getDao(OrmLiteSqliteOpenHelper.java:279)
Build tools 0.13.0, Android Studio 0.8.1, compile and target 21, buildToolsVersion '21.0.1'