Recently in the processing of the SD card read and write problems, the local elipse can run the program submitted to the server when the error, not find the import class, there are some methods are not found, the use of Sourceinsight search source discovery is using the @hide tag class and method.
/** * Description of a storage volume and its capabilities, including the * filesystem path where it could be mounted. * * <span style= "color: #ff0000;" > @hide </span> */public class Storagevolume implements Parcelable {
First explain why this tag appears in the Android source code. Some of the classes and methods that @hide out are because of these classes, methods are being developed or unstable, and may not be found when the user references these classes or methods after the next SDK update. There is a big problem with the stability and compatibility of the program at this time.
To get to the point, when we need to use these methods in our program to realize our function, we can have three ways to achieve it.
1, directly remove the @hide mark, will recompile the Android.jar package replaced;
However, it is strongly recommended not to do so, the class or method hidden by others is certainly unsafe, if you put @hide out may cause some program unpredictable errors.
2, using the reflection mechanism to use the @hide method, this method on the Internet to see a good, easy to understand, to go deep into their own online search
http://blog.csdn.net/annkie/article/details/8466654
3. Modify System files
3.1 Modify Android.mk File
Local_path:= $ (call My-dir) include $ (clear_vars) Local_module_tags: = optionallocal_static_java_libraries: = Android-support-v13local_static_java_libraries + = android-ex-camera2-portabilitylocal_static_java_libraries + = XMP _toolkitlocal_static_java_libraries + = Glidelocal_src_files: = $ (call All-java-files-under, SRC) LOCAL_SRC_FILES + + $ ( Call All-java-files-under, SRC_PD) Local_src_files + = $ (call All-java-files-under, Src_pd_gcam) Local_resource_dir + = $ ( Local_path)/res $ (Local_path)/res_pinclude $ (local_path)/version.mklocal_aapt_flags: =--auto-add-overlay --version-name "$ (version_name_package)"--version-code $ (version_code_package) Local_package_name: = Camera2<s Pan style= "color: #ff0000;" > #LOCAL_SDK_VERSION: = current</span>local_certificate: = platformlocal_proguard_flag_files: = proguard.flagslocal_proguard_enabled: = disabledlocal_jni_shared_libraries: = Libjni_tinyplanet libjni_ Jpegutilinclude $ (build_package) include $ (call All-makefiles-under, $ (Local_path))
Put the red comment off.local_sdk_version is used to specify the SDK version required for the APK project, current is the version of the Android source code, and if commented out will allow the application to access the @hide API
3.2 after commenting out the local_sdk_version, a code obfuscation error occurred when the server compilation was mentioned. This time you can add local_proguard_enabled: = Disabled in the Android.mk file. local_proguard_enabled: = disabled does not use code obfuscation tools for code obfuscation, if not set, the default is to use local_proguard_enabled: = Full. The project code will be completely confused.
I have tried many times to make the code, using the third method.
How does Android reference @hide (hidden) classes, methods, and constants?