Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use this library in Android Studio #48

Open
belikeswap opened this issue Jun 4, 2014 · 9 comments
Open

Unable to use this library in Android Studio #48

belikeswap opened this issue Jun 4, 2014 · 9 comments

Comments

@belikeswap
Copy link

Can I please get a guide on how to setup this library in Android Studio. Whenever, I try to run a project based on this library from Android Studio, this library itself gets built as project and runs as an app instead of the main app that I've built using this library.

@d370urn3ur
Copy link

I had the same problem I think, and I used this work-around to fix it: in the JazzyViewPager's AndroidManifest.xml (NOT your main app's manifest), add the tools xml namespace (xmlns:tools="http://schemas.android.com/tools") to the <manifest> node, then add this line to the MainActivity node: tools:node="remove". Your manifest will look like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.jfeinstein.jazzyviewpager"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name="com.jfeinstein.jazzyviewpager.MainActivity"
            android:label="@string/app_name"
            tools:node="remove">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

It's very strange though, I use other library projects without having this problem.

@kashban
Copy link

kashban commented Oct 24, 2014

@d370urn3ur Not so strange... there should not be an application tag in a library's manifest. AllowBackup="true" also is problematic, as well as theme.

@d370urn3ur
Copy link

True, now that I understand Android Studio better, might as well just remove entire node

@kashban
Copy link

kashban commented Oct 24, 2014

Yes, that would be best. Even better if it were on maven central for gradle dependency import.

@norrisboat
Copy link

None of the above solutions is working for me. Any additional help???

@d370urn3ur
Copy link

just comment out everything in the jazzyViewPager's AndroidManifest.xml. LIke this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.jfeinstein.jazzyviewpager" >

    <!--<uses-sdk-->
        <!--android:minSdkVersion="4"-->
        <!--android:targetSdkVersion="17" />-->

    <!--<application-->
        <!--android:allowBackup="true"-->
        <!--android:icon="@drawable/ic_launcher"-->
        <!--android:label="@string/app_name"-->
        <!--android:theme="@style/AppTheme" >-->
        <!--<activity-->
            <!--android:name="com.jfeinstein.jazzyviewpager.MainActivity"-->
            <!--android:label="@string/app_name"-->
            <!--tools:node="remove">-->
            <!--<intent-filter>-->
                <!--<action android:name="android.intent.action.MAIN" />-->
                <!--<category android:name="android.intent.category.LAUNCHER" />-->
            <!--</intent-filter>-->
        <!--</activity>-->
    <!--</application>-->

</manifest>

@norrisboat
Copy link

Still not working

@d370urn3ur
Copy link

do you have any other library projects that contain application tags in their manifests? only your main module's manifest should have an application tag. Otherwise, I can't really diagnose your problem without seeing your project, it is hosted on Github? My problem was caused by having an activity node in the JazzyViewPager manifest that was replacing my main activity when it was merged with the manifest merger, I am assuming because it was using the MAIN/LAUNCHER intent filter.

@norrisboat
Copy link

Thanks but found another library that works pretty much like this and that's working fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants