Attempting to run a Kotlin Android project using Android Studio compiles successfully and generates an APK, but when Studio tries to install the APK on the device the installation fails with INSTALL_FAILED_DEXOPT. Looking through logcat I can see messages similar to:
12-13 22:43:57.219: ERROR/dalvikvm(1623): Out-of-order method_idx: 0x2bff then 0x2bff
12-13 22:43:57.219: ERROR/dalvikvm(1623): Trouble with item 897 # offset 0x13e498
12-13 22:43:57.219: ERROR/dalvikvm(1623): Swap of section type 2006 failed
12-13 22:43:57.219: ERROR/dalvikvm(1623): ERROR: Byte swap + verify failed
12-13 22:43:57.230: ERROR/dalvikvm(1623): Optimization failed
The project was converted from Java using the Kotlin IDEA plugin's automatic conversion. There are no compiler warnings.
This occurs when a method name collides with a Kotlin-generated etter, for example:
class Foo(val bar: Any) {
fun getBar(): Any {}
}
Rename bar or getBar to something else. For more information see http://youtrack.jetbrains.com/issue/KT-3170
Recently the similar issue has been discovered on devices running api 17- with Kotlin 1.0.0-beta-1038.
To fix this issue use new beta build 1.0.0-beta-1103.
https://devnet.jetbrains.com/message/5561799#5561799
Related
I've built the iOS version of my app about a month or so ago. Then added a few extra messages to the UI, tested with the Android version and now when I rebuild the iOS version it seems to fail. The error log is at: https://s3.amazonaws.com/codenameone-build-response/621a8710-2900-45a3-afdb-e3a30bdb1265-1504680431641-error.txt
At the bottom of this, the only actual failure I see is:
** ARCHIVE FAILED **
The following build commands failed:
CompileC build/Build/Intermediates/ArchiveIntermediates/MyApplication/IntermediateBuildFilesPath/MyApplication.build/Release-iphoneos/MyApplication.build/Objects-normal/arm64/com_codename1_io_websocket_WebSocketNativeImplImpl.o MyApplication-src/com_codename1_io_websocket_WebSocketNativeImplImpl.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Failed xcodebuild step
I have updated the CN1Libs a few days ago. Not really sure what about this is actually failing to build.
Notice that the file com_codename1_io_websocket_WebSocketNativeImplImpl.m is mentioned in the final lines which means that's the file that failed. If you search the file for mentions of com_codename1_io_websocket_WebSocketNativeImplImpl.m you will find:
src/com_codename1_io_websocket_WebSocketNativeImplImpl.m -o /var/folders/zh/kb_4hqhn4kg1h0r5dp_6htcm0000gn/T/build7085253492970683151xxx/dist/build/Build/Intermediates/ArchiveIntermediates/MyApplication/IntermediateBuildFilesPath/MyApplication.build/Release-iphoneos/MyApplication.build/Objects-normal/arm64/com_codename1_io_websocket_WebSocketNativeImplImpl.o
/var/folders/zh/kb_4hqhn4kg1h0r5dp_6htcm0000gn/T/build7085253492970683151xxx/dist/MyApplication-src/com_codename1_io_websocket_WebSocketNativeImplImpl.m:23:9: fatal error: 'com_codename1_io_websocket_WebSocket.h' file not found
#import "com_codename1_io_websocket_WebSocket.h"
^
1 error generated.
This might be a bit confusing but it generally means you added the cn1lib for websockets and didn't use it. That's a problem as our VM strips out unused code but the websockets cn1lib needs to include the callback interface which is now stripped away.
I get this exception when hitting this line of code in my project. Any ideas?
line of code:
var JsonData = JsonConvert.DeserializeObject<LoginModel>(ResultData);
exception:
{System.MissingMethodException: Method 'SQLite.Net.Attributes.AutoIncrementAttribute..ctor' not found.
at (wrapper managed-to-native) System.MonoCustomAttrs:IsDefinedInternal (System.Reflection.ICustomAttributeProvider,System.Type)
at System.MonoCustomA...
oddly it works fine if I run the project in Visual Studio for Mac 2017, but when I run it on VS 2017 on Win 10 I get this exception. Exact same code, no changes. So it must be an environmental thing, but I have no clue what.
Can't build streamer tutorial_3 for android on mac
I,ve got all environment variables needed.
My eclipse can't to resolve some symbols, but to some of them i can get by pushing F3. It's very strange for me.
Here is the command line output:
23:04:06 **** Build of configuration Default for project Tutorial3 ****
/Users/antonivanuskin/android-develop/android-ndk-r10/ndk-build all
GStreamer : [GEN] => gst-build-armeabi/gstreamer_android.c
GStreamer : [COMPILE] => gst-build-armeabi/gstreamer_android.c
GStreamer : [LINK] => gst-build-armeabi/libgstreamer_android.so
lto1: fatal error: bytecode stream generated with LTO version 2.2 instead of the expected 3.0
compilation terminated.
lto-wrapper: /Users/antonivanuskin/android-develop/android-ndk-r10/toolchains/arm- linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc returned 1 exit status
/Users/antonivanuskin/android-develop/android-ndk-r10/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld.gold: fatal error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make: *** [buildsharedlibrary_armeabi] Error 1
23:04:10 Build Finished (took 3s.740ms)*
I use ndk-10r and gst-1.4.0.
I know that there is no interfaces/xoverlay in new streamer.
EDIT
I've built ok, but steel got underlines of many glib-types and GST-macross. Here is a screenshot:
what is interesting that i have no underlined headers, for example: i've include pthread.h but have got underlined pthread_t and phtread_key_t....
i think that i have not install some general libraries on my mac, something like libc or what ever...may it couse this problem? The problem is that i can't run my app from eclipse. and for more: i use DS-5 CE IDE
This is most likely because we build the android 1.4.x cerbero packages with the r9d NDK.
You might want to use the r9d NDK until we provide binaries built with a more recent NDK (started some builds to see if everything goes through fine).
I'm trying out Android Studio on OS X and am running into a mysterious error message. I went through the Google guide to building a simple UI, but when I finished writing the XML file and hit Run in the IDE, I get the following message ("Test2" is the name of the project):
Gradle: Execution failed for task ':Test2:validateDebugSigning'.
> Could not find matching constructor for: org.gradle.tooling.BuildException(java.lang.String)
I have never developed an android app before, so I don't know how common this is. I did a search for this error and found no one encountering the same problem.
I tried the solution from Abhan and I get a new error message:
Error: org.jetbrains.plugins.gradle.settings.GradleSettings cannot be cast to org.jetbrains.plugins.gradle.settings.GradleSettings
It warns you that android plug-in task validateDebugSigning cannot access the debug key. Check your accessibility to the debug.keystore.
On linux or OS X, the default location is ~/.android. On windows, it's in C:\Documents and Settings\.android\ or C:\Users\.android.
I am trying to build Android 4.0.1_r1 on Ubuntu 10.04 64bit. I have followed all the steps as mentioned in the official build document before I initiated "make -j2" for a "full engineering" lunch type.
After 2 hours of compilation , I got this error :-
host Java: doclava (out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/classes)
Exception in thread "main" java.lang.RuntimeException: cts/tools/vm-tests-tf/src/dot/junit/opcodes/xor_long_2addr/Test_xor_long_2addr.java: trouble reading
at com.android.dx.util.FileUtils.readFile(FileUtils.java:87)
at util.build.BuildDalvikSuite.parseTestMethod(BuildDalvikSuite.java:588)
at util.build.BuildDalvikSuite.handleTests(BuildDalvikSuite.java:303)
at util.build.BuildDalvikSuite.compose(BuildDalvikSuite.java:159)
at util.build.BuildDalvikSuite.main(BuildDalvikSuite.java:131)
Caused by: java.io.FileNotFoundException: cts/tools/vm-tests-tf/src/dot/junit/opcodes/xor_long_2addr/Test_xor_long_2addr.java (Too many open files)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:120)
at com.android.dx.util.FileUtils.readFile(FileUtils.java:75)
... 4 more
make: * [out/host/linux-x86/obj/EXECUTABLES/vm-tests-tf_intermediates/tests] Error 1
make: * Waiting for unfinished jobs....
Note: external/doclava/src/com/google/doclava/Stubs.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
After this above error , the build stops.
Modifications I did before the build are as follows :-
From /devices folder I removed Google , Samsung and Ti folder so that they are not included in the build.
In the /build/target/product/core.mk I removed the following apps - Browser, HTMLViewer, Contacts
Although I am a complete beginner in Android source development, I'm having this hunch that the modifications may not be the actual cause of the build failure and root cause lies somewhere else. I need some advice on this.