OSMBonusPack KMLDocument and Android 4.x - kml

I'm using osmdroid 5.6.5 + osmbonuspack 6.4 to process a KML file and show the objects over a map.
All this works fine on Android 5.x+ but fails on Android 4.x:
The code KmlDocument kmlDocument = new KmlDocument(); returns the error "java.lang.VerifyError: "
Anyone can help me to solve this?
Best regards,
NR.

Source of the problem: gson dependency missed on build.gradle.
Solution: add the following line on build.gradle:
enter code hereimplementation 'com.google.code.gson:gson:2.8.0'

Related

error: Cannot figure out how to save this field into database. You can consider adding a type converter for it. - obs in java.util.Observable

I just upgraded my android studio to Artic fox. And all of sudden I am facing an issue saying "error: Cannot figure out how to save this field into database. You can consider adding a type converter for it. - obs in java.util.Observable". It was working fine for the previous android version. Can any one help me please. I am stuck!! I tried every thing but did not work out.
Thanks in advance.
dependencies are as follows:
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10"
implementation 'androidx.room:room-runtime:2.2.5'
kapt 'androidx.room:room-compiler:2.2.5'
androidTestImplementation 'androidx.room:room-testing:2.2.5'

Updated android studio and got fail with Gstreamer build

Updated to Android Studio 3.0.0 with new android gradle plugin.
While buildin project got message:
What went wrong:
Execution failed for task `':app:externalNativeBuildDebug'`.
Expected output file at `gst-build-arm64-v8a/libgstreamer_android.so` for target `gstreamer_android` but there was none
but libgstreamer_android.so library file is already there. For native code I use ndk-build. Does anyone have this issue?
Add to build.gradle file of our android module field targets.
android {
defaultConfig {
externalNativeBuild {
ndkBuild {
targets "name_of_native_module_in_android_mk_file"
}
...
}
Don't add gstreamer_android.
UPDATE: Valery's answer works!
Obsolete answer:
That's not the perfect fix, it's just temporary until I have time to take a deep look into the problem. Downgrade your gradle plugin:
File -> Project Structure
Click at "Project"
At "Gradle version" field put:
3.3
At "Android Plugin Version" field put:
2.3.3
Hit "OK"
Accept the messages, sync the project, etc... Android Studio may prompt a windown asking for update gradle plugin again, just don't accept it for now...
I guess the update on gradle changed the way the builds are made, maybe something on Android.mk will have to change or some other parameter on build.grade...
edit: I found some clue at: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html
API changes Android plugin 3.0.0 introduces API changes that removes
certain functionalities and may break your existing builds. Later
versions of the plugin may introduce new public APIs that replace
broken functionalities.
Modifying variant outputs at build time may not work Using the Variant
API to manipulate variant outputs is broken with the new plugin. It
still works for simple tasks, such as changing the APK name during
build time, as shown below:...
So, I guess we should keep using the temporary fix (not updated version of gradle)...

How to use lombok plugin in Android Studio?

I installed lombok from 'Preferences -> Plugin', but it's not working when I am trying to generate Getter & Setter. My code doesn't recognize it.
Is there anyone having idea how to setup lombok and use it to generate getter & setter annotation?
You need not only to install Lombok Plugin, but also add dependency to build.gradle:
dependencies{
compileOnly 'org.projectlombok:lombok:1.18.12'
annotationProcessor 'org.projectlombok:lombok:1.18.12' //or v. 1.16.2 in your case.
}
More info on official guide.
Another answer with instructions.
There are so many posts on this subject its bewildering.
I am on the following:
And having torn most of my hair out, trying to figure out
what the heck is going on with gradle top level and project level,
THE ONLY COMBINATION that worked for me was this:
implementation 'org.projectlombok:lombok:1.18.0'
annotationProcessor 'org.projectlombok:lombok:1.18.0'classpath 'org.projectlombok:lombok:1.18.0'
And here is the proof:
My god is it really this complicated to do something this simple.
There's a section related to this on official docs: https://projectlombok.org/setup/android
Follow the previous instructions (Gradle). In addition to setting up your gradle project correctly, you need to add the Lombok IntelliJ plugin to add lombok support to Android Studio:
Go to File > Settings > Plugins
Click on Browse repositories...
Search for Lombok Plugin
Click on Install plugin
Restart Android Studio
Modify your application's dependencies block:
dependencies {
compileOnly 'org.projectlombok:lombok:1.16.22'
annotationProcessor 'org.projectlombok:lombok:1.16.22'
}
Just in case be aware that if your project have mixed Kotlin and Java code - you can't use lombok normal way for now.
Based on this issue: https://github.com/projectlombok/lombok/issues/1169
EDIT:
from kotlin 1.7.20 with K2 compiler it is possible withot concerns.
https://kotlinlang.org/docs/whatsnew1720.html#support-for-kotlin-k2-compiler-plugins
You can use this
dependencies {
compileOnly "org.projectlombok:lombok:1.16.18"
}

Android Studio Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'

I'm using Android Studio 1.5.1 and I did was i renamed a working project with a new package. After that, I encountered the problem i mentioned above.
I can't for the life of me figure out how to fix this. I've tried adding the dependency files already. All of the solutions points to editing build.gradle file but I don't have that file because this project is imported from a eclipse project. Can anyone help me please?
Regards,
Dexter
If you want to add dependency,follow the steps below.
1.file->new->Import Module.
after import module
2.file->Project Structure->app->dependency tab-> add library dependencies.
3.In build.gradle(your module) change to apply plugin: 'com.android.library'
if you get any error regarding min and target sdk versions, then choose 4th step other wise exclude 4th step(first 3 step enough).
4.file->Project Structure->example ->Flavors tab //change minimum and target sdk versions().

Xcode 4.5 // import CoreLocation shows: Expected ';' after method prototype

After download the latest version of the Xcode 4.5 I receive the next trouble.
We use the CoreLocation library, but the when we try to build the project it fails because found the next error:
Parse Issue: "Expected ';' after method prototype" at CLLocationManager.h
In this method:
- (void)allowDeferredLocationUpdatesUntilTraveled:(CLLocationDistance)distance
timeout:(NSTimeInterval)timeout __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_6_0);
Any suggestions?
I have found a solution for me:
I installed iOS SDK 5.1 on Xcode 4.5.
Check it here: How can I add older version of iOS SDK in Xcode 4.5
And it worked for me..
I evaluated the configuration of the project, with a new Xcode 4.5 project ... without success ... trying to apply the same compiler conditions and so on ...
The next step was trying to make the code compliant with the iOS 6 specs (solving deprecated code) and converting the code to the ARC requirements
And, after a couple of hours of frustrating work ... I decided to unblock the file CoreLocation.h on the library directory and comment the method.
I now that is not the solution, but I didn't found any other solution. If anybody has been found any other possibility please ... let me know

Resources