Import three-party package, appear classnotfoundexception

Source: Internet
Author: User

An activity in the settings module needs to be referenced in the project. After you import the Settins.jar package in Eclipse, start it using the following methods, for example:

Intent Intent = new Intent () intent.setaction ("Android.settings.INPUT_METHOD_SETTINGS"); Intent.addcategory (" Android.intent.category.VOICE_LAUNCH "); Intent.setclass (this, datetimesettingssetupwizard.class); StartActivity ( Intent);

Compile does not error, but in the execution of the prompt: ClassNotFoundException error. Find a solution to join the three-party library on the Internet. Later a change is realized, and do not need to import Settings.jar this library.

Intent Intent = new Intent (); Intent.setaction ("Android.settings.INPUT_METHOD_SETTINGS"); ComponentName C = new ComponentName ("Com.android.settings", "com.android.settings.LanguageSettings"); Intent.setcomponent (c); Intent.addcategory ("Android.intent.category.VOICE_LAUNCH"); StartActivity (intent);

Yes, that's the way to set up componentname. There is no need to import the package, and there is no error executing.

It is unclear why the package was imported and an error occurred. It is possible that after the package is imported into the software, the actual loading, initialization is done within the space of the application. The class you want to reference is in the system's package and is not in a space, causing the class to be found.


Friends who have better explanations or have any clues, want to add in the comments. Humbly

This article will be updated as part of the review.


Import three-party package, appear classnotfoundexception

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.