java.lang.VerifyError: me.xxx.menu.MenuListFragment only on Android 2.x.x - actionbarsherlock

after almost 2 week trying to solve this strange problem, I give up!
Basically a get the java.lang.VerifyError every time I try to run my app
only in devices with Android 2.x.x. From 3.x.x all are going well.
In the project I'm using this two external library:
Action Bar Sherlock - http://actionbarsherlock.com/ - updated at the v4.4.0
Sliding Menu - https://github.com/jfeinstein10/SlidingMenu
This is what the LogCat return every time:
FATAL EXCEPTION: main
java.lang.VerifyError: me.xxx.menu.MenuListFragment
at me.xxx.menu.BaseSlidingMenuActivity.onCreate(BaseSlidingMenuActivity.java:46)
at me.xxx.menu.SlidingMenuCustomAnimation.onCreate(SlidingMenuCustomAnimation.java:28)
at me.xxx.XXXActivity.onCreate(XXXActivity.java:130)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
and this is how the BaseSlidingMenuActivity.java looks like around the line 46:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(mTitleRes);
// set the Behind View
setBehindContentView(R.layout.frame_content);
if (savedInstanceState == null) {
FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
mFrag = new MenuListFragment(); <--- ERROR HERE!
t.replace(R.id.frame_content, mFrag);
t.commit();
} else {
mFrag =(SherlockListFragment)this.getSupportFragmentManager()
.findFragmentById(R.id.frame_content);
}
...
...
}
Where MenuListFragment() is a SlidingFragmentActivity that extend a SherlockFragmentActivity
and implements SlidingActivityBase.
Of course I googled the problem, and seems that a lot of people are getting this
issue with the last version of the Android SDK tool, i.e. v22.x.x , in fact a have
the v22.6.3.
Some people resolved the VerifyError just putting the Check on the "Private Libraries"
box, inside "BuildPath->Configure BuildPath->Order and Export" menĂ¹, as explained
in other conversation about the VerifyError, but for me doesn't work, even because the "Private Libraries" was already checked. So the libraries/imports situation seems to be ok!
Hoping that someone already fund a solution for that! I'm getting crazy! :D
Thank you!

I finally found the solution!
Recap! Basically the are two main reason in which you can get this error:
(In my case) I was getting the VerifyError all the time that I tried to run my app on devices with API Level under 10 , because I was trying to catch an SQLiteDatabaseLockedException that are supported from the Android API Level 11. So to solve it check that every Exception or possible method (i.e. String.isEmpty() is supported from API Level 9) is supported form your minimum API Level.
While I was searching for a solution I found a lot of people that got the VerifyError because there was some problem with Libraries Imports, as explained in this post: http://commonsware.com/blog/2013/05/23/do-not-manually-modify-eclipse-build-path-except-now-r22.html
Hope that will help someone beyond me! :D
Bye Bye! Caterpillar.

Related

Error on load Chrome Custom Tab in Android 11

Chrome custom tab work in every other device. Only error in Android 11.
Here is my code how I put I code in my app.
ImageView adCustomBannerImage= findViewById(R.id.adCustomBannerImage);
adCustomBannerImage.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String urlCustomBannerAd= getResources().getString(R.string.urlCustomBannerAdQureka);
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent=builder.build();
customTabsIntent.launchUrl(getApplicationContext(),Uri.parse(urlCustomBannerAd));
}
});
When I click on ImageView then this error come in Android 11
2022-03-11 10:22:21.344 3059-3059/com.udai.aadharloan.kredit.finance.pmscheme E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.udai.aadharloan.kredit.finance.pmscheme, PID: 3059
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:1018)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:425)
at androidx.core.content.ContextCompat$Api16Impl.startActivity(ContextCompat.java:830)
at androidx.core.content.ContextCompat.startActivity(ContextCompat.java:279)
at androidx.browser.customtabs.CustomTabsIntent.launchUrl(CustomTabsIntent.java:376)
at com.udai.aadharloan.kredit.finance.pmscheme.MainActivity$1.onClick(MainActivity.java:76)
at android.view.View.performClick(View.java:7448)
at android.view.View.performClickInternal(View.java:7425)
at android.view.View.access$3600(View.java:810)
at android.view.View$PerformClick.run(View.java:28305)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
After too much research on this topic I found 3 helpful page. But I am not much pro developer, So I cann't understand these documentations terms.
Using Custom Tabs with Android 11
Package visibility in Android 11
Fulfilling common use cases while having limited package visibility
So any developer can tell me pls, what is need to change in my code.
Thanks in advance:)
Remove getApplicationContext() and pass your_activityname.this
customTabsIntent.launchUrl(your_activityname.this,Uri.parse(urlCustomBannerAd));

Why everytime open a new flutter project this error appear?

I have tried a different kind of ways to resolve the error but still can't resolve, and I'm still a new learner on flutter. But I still can run the whole project well without resolving the error shown.
There is no error that's just ide warning I think, that could be about typo etc, If you click to lamp and show us the suggestions then we can help more.
But I tried this part of code and get different warning and solved it with add # to override such as;
class MainActivity: FlutterActivity(){
#override fun configureFlutterEngine(#NonNull flutterEngine: FlutterEngine){
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
If that's show same you need to check your ide settings, probably there is a missing plugin(Dart or Flutter).

Optaplanner multithreading attempt yielded "missing rebase" on custom move

I updated from 7.5 to 7.9 Optaplanner libraries for use with a variant of the nurserostering code, and used the release notes (for example, some method names changed) to successfully rebuild and re-run. Then, I added the "moveThreadCount" xml line (for multithreading) to my solver config xml.
<moveThreadCount>AUTO</moveThreadCount>
Running then immediately threw an error:
Caused by: java.lang.UnsupportedOperationException: The custom move class (class westgranite.staffrostering.solver.move.EmployeeChangeMove) doesn't implement the rebase() method, so multithreaded solving is impossible.
I do have a number of custom moves. I did not see any reference to the need to add a rebase() method in the release notes, nor do I see a reference to rebase() in the current (newer) documentation section on building custom moves.
https://docs.optaplanner.org/7.12.0.Final/optaplanner-docs/html_single/index.html#customMoves
Would someone please point me the right way? Thanks!
I would suggest reading this excellent blog post: http://www.optaplanner.org/blog/2018/07/03/AGiantLeapForwardWithMultithreadedIncrementalSolving.html as it gives a more in depth explanation of how multithreaded solving works.
I also suggest to read the javadoc on the rebase method, it should point you in the right direction: https://docs.optaplanner.org/7.12.0.Final/optaplanner-javadoc/org/optaplanner/core/impl/heuristic/move/Move.html#rebase-org.optaplanner.core.impl.score.director.ScoreDirector-
Here's an example:
public class CloudComputerChangeMove extends AbstractMove<CloudBalance> {
private CloudProcess cloudProcess;
private CloudComputer toCloudComputer;
...
#Override
public CloudComputerChangeMove rebase(ScoreDirector<CloudBalance> destinationScoreDirector) {
return new CloudComputerChangeMove(
destinationScoreDirector.lookUpWorkingObject(cloudProcess),
destinationScoreDirector.lookUpWorkingObject(toCloudComputer));
}
}

What is the meaning of 'cannot resolve symbol R' error in android studio?

When I try to compile my project it says cannot resolve symbol R. why do I get that error? If it's because an xml file is corrupted what is the solution to the above issue?
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.advanced_quiz);
}
This happens all the time to me as well. Especially when going between versions or basically changing anything with Android Studio.
Without more information, I can't give you a definite answer, but typically cleaning and rebuilding the project fixes these issues for me.
Go to "Build", then "Clean Project." After that, go to "Build", then "Rebuild project."
Let me know if that works. If it doesn't, there are other possible solutions I can add.

Crash related to UITableViewController / UISearchDisplayController in MonoTouch/Xamarin.iOS

I'm having problem to find the cause of random crashes in my app. The crashes only occurs when I build in release mode and run on a device like iPhone or iPad. Running in debug on simulator no crashes occurs. My guess is that the problem has something to do with these two lines in the crash log,
6 UIKit 0x34a193d0 -[UISearchDisplayController _destroyManagedTableView] + 68
7 UIKit 0x34a2195a -[UISearchDisplayController dealloc] + 94
I've uploaded the source code of my UITableViewController and the full crash log here, https://gist.github.com/Nordis/6128735
All help to track the cause of the crashes is much appreciated!
Update
I've now crated a bug report, I looked and the thread Rolf suggested in the comments. So I downloaded the test case, applied the fix. But still exactly the same crash and the stack trace is very similar to what mine looks like.
https://bugzilla.xamarin.com/show_bug.cgi?id=13703
The solution provided by Rolf at Xamarin was fairly simple, all I had to do was to move the code from Dispose() to ViewDidDisappear() in my UITableViewController,
public override void ViewDidDisappear (bool animated)
{
searchController.SearchResultsSource = null;
searchController.Delegate = null;
base.ViewDidDisappear (animated);
}

Resources