Skip to content

Input aar file type support #9

Open

Description

@roblav96

How would I go about using an aar file instead of jar? I'd like to input play-services-maps-9.4.0.aar into the dts-generator.

Activity

  1. petekanev commented on Sep 30, 2016

    @petekanev
    Contributor

    @roblav96 for the time being you can extract the classes.jar from the .aar and pass it as a parameter to the generator. Feel free to rename the .jar to whatever you feel like to avoid naming conflicts.

  2. petekanev commented on Nov 7, 2016

    @petekanev
    Contributor

    @roblav96 A little unrelated to the issue, but thought it's worth sharing - I tried inputting as many jars and aars into the generator and it kind of... worked. Due to limitations in TypeScript and JavaScript modules (namespaces) that contain .android. anywhere in the namespace will confuse the TypeScript compiler, and invalidate all previously declared classes in android. (Android SDK) resulting in TSC errors.
    Google's play-services libraries reside in the com.google.android.gms note the .android. and that is a showstopper for now.

    For these reasons we are rolling out dts generation support behind a tns build/run android --androidTypings flag , in 2.4.0, with support for only the android SDK and all android support libraries

  3. roblav96 commented on Nov 7, 2016

    @roblav96
    ContributorAuthor

    @Pip3r4o Interesting. That might explain why I could never get full https://github.com/OneSignal/OneSignal-Android-SDK declarations since it required com.google.android.gms.

    What's strange is that when I throw com.soundcloud.android.crop https://github.com/jdamcd/android-crop through the generator the declarations come out fine.

    declare module com {
        export module soundcloud {
            export module android {
                export module crop {
                    export class Crop extends java.lang.Object {
                        public static REQUEST_CROP: number;
                        public static REQUEST_PICK: number;
                        public static RESULT_ERROR: number;
                        public start(param0: android.content.Context, param1: android.support.v4.app.Fragment, param2: number): void;
                        public static pickImage(param0: android.app.Activity): void;
                        public start(param0: android.content.Context, param1: android.support.v4.app.Fragment): void;
                        public asSquare(): com.soundcloud.android.crop.Crop;
                        public static of(param0: android.net.Uri, param1: android.net.Uri): com.soundcloud.android.crop.Crop;
                        ...
                    }
                }
            }
        }
    }
  4. petekanev commented on Nov 7, 2016

    @petekanev
    Contributor

    @roblav96 declarations do come out fine-looking, executing tsc however will throw errors saying content not found on com.soundcloud.android when the typing should instead be referring to android.content.Context

  5. roblav96 commented on Nov 9, 2016

    @roblav96
    ContributorAuthor

    @Pip3r4o Yes that's certainly true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions