About the use of the Class.forName () method in Android studio to dynamically get the class instance report no class found exception processing methods

Source: Internet
Author: User

Recently, when doing a project, we need to use the method of reflecting back and forth tone class, but in the reflection process always throws no class found exception in the Class.forName () method, after several checks, problem solving, summarizes the cause of the problem

The class name in the parameter of 1.class.forname () must be the full package name + class name

2. is 1 derivative, in Android Studio, once the package name of the project has been modified, Also need in the auto-generated Build.gradle file (Project Android view) to change the ApplicationID to the modified package name, or install the app after the package name or original, it will cause 1 errors.

The author is 2 card for a long time, finally found a long time to solve, in this record, I hope to help meet this problem friends save time

About the use of the Class.forName () method in Android studio to dynamically get the class instance report no class found exception processing methods

Related Article

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.