Android's decompiled .class file don't show all methods of the corresponding .java file











up vote
0
down vote

favorite
1












So, I'm building an app to copy all my messages (AND mms, WITH attachments) from iOS (iTunes backup) to Android Pie (OxygenOS).



I went through Android's SmsManager.java file, and I noticed two methods:




  • importTextMessage(...)

  • importMultimediaMessage(...)


They appear to be the ones I'm looking for, but:




  • They don't appear in the decompiled SmsManager.class file

  • When I still try to use it, compiler complains

  • And last, they are not documented.


So, questions. Why do they appear in SmsManager.java but not in SmsManager.class (jetbrains decompiler)? Why aren't they documented? How can I use these methods?



EDIT: I successfully restored my backup on my OnePlus 6T. If you want a working project, see here https://github.com/let-aurn/iosmessagetoandroid.










share|improve this question
























  • Ok. I just noticed these methods have the @hide attribute in the java-doc. Can I still use them somehow?
    – David
    Nov 18 at 1:22












  • "When I still try to use it, compiler complains" - What does it say?
    – Stephen C
    Nov 18 at 2:49










  • @StephenC, compiler says methods don't exist
    – David
    Nov 18 at 10:36















up vote
0
down vote

favorite
1












So, I'm building an app to copy all my messages (AND mms, WITH attachments) from iOS (iTunes backup) to Android Pie (OxygenOS).



I went through Android's SmsManager.java file, and I noticed two methods:




  • importTextMessage(...)

  • importMultimediaMessage(...)


They appear to be the ones I'm looking for, but:




  • They don't appear in the decompiled SmsManager.class file

  • When I still try to use it, compiler complains

  • And last, they are not documented.


So, questions. Why do they appear in SmsManager.java but not in SmsManager.class (jetbrains decompiler)? Why aren't they documented? How can I use these methods?



EDIT: I successfully restored my backup on my OnePlus 6T. If you want a working project, see here https://github.com/let-aurn/iosmessagetoandroid.










share|improve this question
























  • Ok. I just noticed these methods have the @hide attribute in the java-doc. Can I still use them somehow?
    – David
    Nov 18 at 1:22












  • "When I still try to use it, compiler complains" - What does it say?
    – Stephen C
    Nov 18 at 2:49










  • @StephenC, compiler says methods don't exist
    – David
    Nov 18 at 10:36













up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





So, I'm building an app to copy all my messages (AND mms, WITH attachments) from iOS (iTunes backup) to Android Pie (OxygenOS).



I went through Android's SmsManager.java file, and I noticed two methods:




  • importTextMessage(...)

  • importMultimediaMessage(...)


They appear to be the ones I'm looking for, but:




  • They don't appear in the decompiled SmsManager.class file

  • When I still try to use it, compiler complains

  • And last, they are not documented.


So, questions. Why do they appear in SmsManager.java but not in SmsManager.class (jetbrains decompiler)? Why aren't they documented? How can I use these methods?



EDIT: I successfully restored my backup on my OnePlus 6T. If you want a working project, see here https://github.com/let-aurn/iosmessagetoandroid.










share|improve this question















So, I'm building an app to copy all my messages (AND mms, WITH attachments) from iOS (iTunes backup) to Android Pie (OxygenOS).



I went through Android's SmsManager.java file, and I noticed two methods:




  • importTextMessage(...)

  • importMultimediaMessage(...)


They appear to be the ones I'm looking for, but:




  • They don't appear in the decompiled SmsManager.class file

  • When I still try to use it, compiler complains

  • And last, they are not documented.


So, questions. Why do they appear in SmsManager.java but not in SmsManager.class (jetbrains decompiler)? Why aren't they documented? How can I use these methods?



EDIT: I successfully restored my backup on my OnePlus 6T. If you want a working project, see here https://github.com/let-aurn/iosmessagetoandroid.







java android android-studio smsmanager






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 13 hours ago

























asked Nov 18 at 1:18









David

2,20032041




2,20032041












  • Ok. I just noticed these methods have the @hide attribute in the java-doc. Can I still use them somehow?
    – David
    Nov 18 at 1:22












  • "When I still try to use it, compiler complains" - What does it say?
    – Stephen C
    Nov 18 at 2:49










  • @StephenC, compiler says methods don't exist
    – David
    Nov 18 at 10:36


















  • Ok. I just noticed these methods have the @hide attribute in the java-doc. Can I still use them somehow?
    – David
    Nov 18 at 1:22












  • "When I still try to use it, compiler complains" - What does it say?
    – Stephen C
    Nov 18 at 2:49










  • @StephenC, compiler says methods don't exist
    – David
    Nov 18 at 10:36
















Ok. I just noticed these methods have the @hide attribute in the java-doc. Can I still use them somehow?
– David
Nov 18 at 1:22






Ok. I just noticed these methods have the @hide attribute in the java-doc. Can I still use them somehow?
– David
Nov 18 at 1:22














"When I still try to use it, compiler complains" - What does it say?
– Stephen C
Nov 18 at 2:49




"When I still try to use it, compiler complains" - What does it say?
– Stephen C
Nov 18 at 2:49












@StephenC, compiler says methods don't exist
– David
Nov 18 at 10:36




@StephenC, compiler says methods don't exist
– David
Nov 18 at 10:36












2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










Methods annotated with @hide are not part of the public Android API and are not designed to be used by developers. They are often internal to the class only and are subject to change across Android versions.



You can call these methods via reflection, but do so with caution as they may change or be removed. You should always check when the method appeared in the .java file, when the signature changed and if/when it got removed. Then wrap your code in Android version checks where needed.






share|improve this answer




























    up vote
    1
    down vote















    1. The @hide javadoc annotation should only hide the method from the javadocs. However, the Android documentation states this:




      In general, apps should only use the officially documented parts of the classes in the SDK. In particular, this means that you should not plan to access methods or fields that are not listed in the SDK when you interact with a class via semantics such as reflection.




      Then it goes on to explain that reflective and other access to internal APIs may be blocked by various means.



      Source: Restrictions on non-SDK interfaces



    2. It is possible that the methods have been removed by either modifying the source code that the ".class" files were built from, or by some bytecode manipulation after the compilation. This would have been done to prevent you writing code that depended on the internal API methods by accident.


    3. If the methods aren't there (for whatever reason) in the interfaces you compiled against, you shouldn't be trying other ways to access. Even if you succeed this is liable to cause portability issues in the future.







    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357089%2fandroids-decompiled-class-file-dont-show-all-methods-of-the-corresponding-ja%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote



      accepted










      Methods annotated with @hide are not part of the public Android API and are not designed to be used by developers. They are often internal to the class only and are subject to change across Android versions.



      You can call these methods via reflection, but do so with caution as they may change or be removed. You should always check when the method appeared in the .java file, when the signature changed and if/when it got removed. Then wrap your code in Android version checks where needed.






      share|improve this answer

























        up vote
        1
        down vote



        accepted










        Methods annotated with @hide are not part of the public Android API and are not designed to be used by developers. They are often internal to the class only and are subject to change across Android versions.



        You can call these methods via reflection, but do so with caution as they may change or be removed. You should always check when the method appeared in the .java file, when the signature changed and if/when it got removed. Then wrap your code in Android version checks where needed.






        share|improve this answer























          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          Methods annotated with @hide are not part of the public Android API and are not designed to be used by developers. They are often internal to the class only and are subject to change across Android versions.



          You can call these methods via reflection, but do so with caution as they may change or be removed. You should always check when the method appeared in the .java file, when the signature changed and if/when it got removed. Then wrap your code in Android version checks where needed.






          share|improve this answer












          Methods annotated with @hide are not part of the public Android API and are not designed to be used by developers. They are often internal to the class only and are subject to change across Android versions.



          You can call these methods via reflection, but do so with caution as they may change or be removed. You should always check when the method appeared in the .java file, when the signature changed and if/when it got removed. Then wrap your code in Android version checks where needed.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 18 at 3:51









          Greg Moens

          1095




          1095
























              up vote
              1
              down vote















              1. The @hide javadoc annotation should only hide the method from the javadocs. However, the Android documentation states this:




                In general, apps should only use the officially documented parts of the classes in the SDK. In particular, this means that you should not plan to access methods or fields that are not listed in the SDK when you interact with a class via semantics such as reflection.




                Then it goes on to explain that reflective and other access to internal APIs may be blocked by various means.



                Source: Restrictions on non-SDK interfaces



              2. It is possible that the methods have been removed by either modifying the source code that the ".class" files were built from, or by some bytecode manipulation after the compilation. This would have been done to prevent you writing code that depended on the internal API methods by accident.


              3. If the methods aren't there (for whatever reason) in the interfaces you compiled against, you shouldn't be trying other ways to access. Even if you succeed this is liable to cause portability issues in the future.







              share|improve this answer



























                up vote
                1
                down vote















                1. The @hide javadoc annotation should only hide the method from the javadocs. However, the Android documentation states this:




                  In general, apps should only use the officially documented parts of the classes in the SDK. In particular, this means that you should not plan to access methods or fields that are not listed in the SDK when you interact with a class via semantics such as reflection.




                  Then it goes on to explain that reflective and other access to internal APIs may be blocked by various means.



                  Source: Restrictions on non-SDK interfaces



                2. It is possible that the methods have been removed by either modifying the source code that the ".class" files were built from, or by some bytecode manipulation after the compilation. This would have been done to prevent you writing code that depended on the internal API methods by accident.


                3. If the methods aren't there (for whatever reason) in the interfaces you compiled against, you shouldn't be trying other ways to access. Even if you succeed this is liable to cause portability issues in the future.







                share|improve this answer

























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote











                  1. The @hide javadoc annotation should only hide the method from the javadocs. However, the Android documentation states this:




                    In general, apps should only use the officially documented parts of the classes in the SDK. In particular, this means that you should not plan to access methods or fields that are not listed in the SDK when you interact with a class via semantics such as reflection.




                    Then it goes on to explain that reflective and other access to internal APIs may be blocked by various means.



                    Source: Restrictions on non-SDK interfaces



                  2. It is possible that the methods have been removed by either modifying the source code that the ".class" files were built from, or by some bytecode manipulation after the compilation. This would have been done to prevent you writing code that depended on the internal API methods by accident.


                  3. If the methods aren't there (for whatever reason) in the interfaces you compiled against, you shouldn't be trying other ways to access. Even if you succeed this is liable to cause portability issues in the future.







                  share|improve this answer
















                  1. The @hide javadoc annotation should only hide the method from the javadocs. However, the Android documentation states this:




                    In general, apps should only use the officially documented parts of the classes in the SDK. In particular, this means that you should not plan to access methods or fields that are not listed in the SDK when you interact with a class via semantics such as reflection.




                    Then it goes on to explain that reflective and other access to internal APIs may be blocked by various means.



                    Source: Restrictions on non-SDK interfaces



                  2. It is possible that the methods have been removed by either modifying the source code that the ".class" files were built from, or by some bytecode manipulation after the compilation. This would have been done to prevent you writing code that depended on the internal API methods by accident.


                  3. If the methods aren't there (for whatever reason) in the interfaces you compiled against, you shouldn't be trying other ways to access. Even if you succeed this is liable to cause portability issues in the future.








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 18 at 4:35

























                  answered Nov 18 at 2:56









                  Stephen C

                  508k69554905




                  508k69554905






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357089%2fandroids-decompiled-class-file-dont-show-all-methods-of-the-corresponding-ja%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Create new schema in PostgreSQL using DBeaver

                      Deepest pit of an array with Javascript: test on Codility

                      Costa Masnaga