Code Monkey home page Code Monkey logo

Comments (13)

dgy5258565 avatar dgy5258565 commented on July 18, 2024 4

To solve this problem, please manually download the plug-in package and put it into the plugins folder under the Android studio installation directory. It will take effect immediately and will not remind the plug-in error if it is started again

from android-parcelable-intellij-plugin.

jschleppy avatar jschleppy commented on July 18, 2024 2

I've been able to get it to temporarily work for the current session if I first manually delete the plugin jar from here (if on Windows):
C:\Users\{username}\AppData\Roaming\Google\AndroidStudio4.1\plugins, and then using the "Install Plugin from Disk" option to manually re-install the plugin jar. Doing this, the plugin appears to then be accepted and usable. However, once you close and relaunch Android Studio, you'll encounter the same incompatibility error and auto-disabling of the plugin, so you must do this each time. It's very frustrating.

from android-parcelable-intellij-plugin.

raedev avatar raedev commented on July 18, 2024 2

I've been support for android studio 4.1, please download this.
https://github.com/raedev/android-parcelable-intellij-plugin/blob/fix_4.1/android-parcelable-intellij-plugin-4.1.jar

from android-parcelable-intellij-plugin.

nagendraksrivastava avatar nagendraksrivastava commented on July 18, 2024 2

No plugin is needed, just write implements Parcelable in the class and you should see one red bulb click on that you can see an option "add parcelable implementation" select that and parcelable code will be generated

Android Studio 4.1 has inbuilt support, I am using Android studio 4.1.1

from android-parcelable-intellij-plugin.

jschleppy avatar jschleppy commented on July 18, 2024 1

To solve this problem, please manually download the plug-in package and put it into the plugins folder under the Android studio installation directory. It will take effect immediately and will not remind the plug-in error if it is started again

You rock! If anyone is confused, there's the User's AppData location where plugins are normally installed to via the plugin manager (as per my comment above). However, if you place the plugin jar into the Android Studio app installation directory, such as "C:\Program Files\Android\Android Studio\plugins" on Windows, then it works as expected for every session thereafter, just as dgy5258565 described!

Couple notes:

  1. Do make sure to delete it from the User's AppData location first.
  2. I suspect this may need to be redone on upgrades to Android Studio if that process wipes unexpected plugins from the installation directory.

from android-parcelable-intellij-plugin.

mtafrias avatar mtafrias commented on July 18, 2024 1

The Android Studio implementation option does not work (at least on my case) with all types of objects. It does't write code for Dates, BigDecimals, enums, etc.

from android-parcelable-intellij-plugin.

adamearle392 avatar adamearle392 commented on July 18, 2024

I use this plugin all the time, making it compatible with Android Studio v4.1 would be a lifesaver!
I'm on macOS Catalina Version 10.15.7.

from android-parcelable-intellij-plugin.

jschleppy avatar jschleppy commented on July 18, 2024

-- edit --
Scratch that.
If I'm getting downvoted explaining how exactly the same behavior is already inbuilt in Android Studio I'm going to do s***
Go install a jar from some chinese dude then.. xD

I wish you hadn't deleted your original post, as it was helpful and I learned something from it. I also wish those who downvoted you would've replied stating why they prefer the plugin vs what you suggested. Aside from that, I'm not sure why you're bringing up ethnicity or why that matters in the land of software development. I realize you're upset because of the downvotes, but maybe avoid talking that way in general, as it comes across very negatively.

Anyways, as I said, I honestly didn't know Android Studio had this built-in now! Albeit behind the context options and not generate options. The generated code is a bit different but does appear to look good, so I will try this out next time I need to implement Parcelable. And don't take this the wrong way, but I'm going to re-post what you had deleted, as it may help others to know of alternatives available now, as it did for me.

Original post:

Android Studio (4.1) supports creating and implementing all required methods for Parcelable by default, no need for this plugin anymore.

Add "implements Parcelable" to class definition
Click the red light-bulb and choose "Implement methods", click "OK"
Click the class definition (red class name), click the red light-bulb again and choose "Add Parcelable Implementation"

I'll add to this that you don't require seeing the red light-bulb, but simply Alt+Enter (on Windows) to get context menu on the class name is enough to see new "Add Parcelable Implementation" as well as "Remove Parcelable Implementation" if one is already provided.

Cheers!

from android-parcelable-intellij-plugin.

jschleppy avatar jschleppy commented on July 18, 2024

The Android Studio implementation option does not work (at least on my case) with all types of objects. It does't write code for Dates, BigDecimals, enums, etc.

Thanks, I'm seeing same behavior out of the box, silently omitting them. I wasn't at first because I actually had a Parcelable implementation on my enums, of which the AS implementation doesn't generate correctly for either. I have not tested it, but diving through Parcelable code seems to appear to line up in allowing these to work if I write my enums to implement Parcelable like this example:

public enum ApprovalStatus implements Parcelable {
    APPROVED,
    FEATURED,
    PENDING,
    REJECTED;
    public static Parcelable.Creator<ApprovalStatus> CREATOR = new Parcelable.Creator<ApprovalStatus>() {
        public ApprovalStatus createFromParcel(Parcel source) {
            return ApprovalStatus.values()[source.readInt()];
        }

        public ApprovalStatus[] newArray(int size) {
            return new ApprovalStatus[size];
        }
    };

    @Override
    public int describeContents() {
        return hashCode();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(ordinal());
    }
}

Then on a class utilizing this enum, generates the following Parcelable code:

approvalStatus = in.readParcelable(ApprovalStatus.class.getClassLoader());

and

dest.writeParcelable(approvalStatus, flags);

Although, I don't have any recommendations for Date and BigDecimal, apart from extending them to custom classes and providing a Parcelable implementation too, if that's possible.

from android-parcelable-intellij-plugin.

linjson avatar linjson commented on July 18, 2024

support android studio for 4.1.1
https://github.com/linjson/android-parcelable-intellij-plugin/blob/master/ParcelableCodeGen.jar

from android-parcelable-intellij-plugin.

jschleppy avatar jschleppy commented on July 18, 2024

No plugin is needed, just write implements Parcelable in the class and you should see one red bulb click on that you can see an option "add parcelable implementation" select that and parcelable code will be generated

Android Studio 4.1 has inbuilt support, I am using Android studio 4.1.1

Thanks, but this and reasons to not trust that method have already been addressed above. Unfortunately this plugin is still superior to the official built-in method in some ways. For now at least.

from android-parcelable-intellij-plugin.

nagendraksrivastava avatar nagendraksrivastava commented on July 18, 2024

Can you please shed some light? about the benefit provided by the plugin than inbuilt support, which will help others

from android-parcelable-intellij-plugin.

jschleppy avatar jschleppy commented on July 18, 2024

Can you please shed some light? about the benefit provided by the plugin than inbuilt support, which will help others

Meant to reply a long time ago, but as I said in my original reply, it's all explained above. I'll repeat the short of it: the built-in one doesn't work for all cases. It fails on Dates, BigDecimals, enums, and probably others.

I also personally find it cumbersome to generate the code since it doesn't use the "generate" context menu.

Hope that helps answer your question.

from android-parcelable-intellij-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.