imported projects give error in android studio 1.2.1.1

前端 未结 6 1892
旧巷少年郎
旧巷少年郎 2020-12-16 20:33

i use android studio 1.2.1.1 and it doesn\'t give me any error for new projects. but for imported projects it gives me an warning about mismatched Encoding (this issue). i c

相关标签:
6条回答
  • 2020-12-16 20:57

    FIRST :

    libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
    

    iCCP are just warnings. they are not errors and they dont failed your app build so ignore it.

    SECOND :

    The actual error is

    F:\Work\workspace\NITask\app\build\intermediates\res\debug\drawable-hdpi-v4\ic_launcher.png: error: Duplicate file.
    F:\Work\workspace\NITask\app\build\intermediates\res\debug\drawable-hdpi\ic_launcher.png: Original is here. The version qualifier may be implied.
    

    This error may occur because of 3rd party libraries uses ic_launcher in thr library. You can solve this by :

    1) clean your project and rebuild it.

    2) create a folder "mipmap-mdpi","mipmap-hdpi","mipmap-xhdpi","mipmap-xxhdpi" and copy the ic_launcher icons and place it in the respective folder based on the sizes.

    res/
    mipmap-mdpi/ic_launcher.png (48x48 pixels)
    mipmap-hdpi/ic_launcher.png (72x72)
    mipmap-xhdpi/ic_launcher.png (96x96)
    mipmap-xxhdpi/ic_launcher.png (144x144)
    mipmap-xxxhdpi/ic_launcher.png (192x192)
    

    give reference to the icon in your xml file as

    android:icon="@mipmap/ic_launcher"
    

    The reason for the mipmap folder (According to Google) :

    It’s best practice to place your app icons in mipmap- folders (not the drawable- folders) because they are used at resolutions different from the device’s current density.

    3) If above solution doesn't solve, then rename the drawable-* folder as drawable-*-v4 (where * is mdpi, hdpi, xhdpi or xxhdpi) and place all your drawables in them.

    res/ 
    drawable-mdpi-v4/
    drawable-hdpi-v4/
    drawable-xhdpi-v4/
    drawable-xxhdpi-v4/
    

    after this do the 1) point and try

    0 讨论(0)
  • 2020-12-16 21:02

    Simply Rename the Image (Rightclick on the Image, Select Refactor and select Rename). It will solve the issue as the Issue has arise as one of the library is also using the image with the same name.

    0 讨论(0)
  • 2020-12-16 21:10

    If you are facing this issue, chances are that you are working on Windows which has a character limit of 260 characters. Check your path to your workspace has, chances are that it is crossing the character limits If not then it comes to the problem when gradle start merging your dependencies.

    So during this merging process, your full path becomes \todo-mvp\todoapp\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\24.2.0\res\drawable-hdpi-v4 in addition to Path_up_to_your_workscpace, as the window had a limit of 260 characters scripts starts falling out as it is not able to do write operations.

    FIX

    Try to shorten the path that leads to your workspace.

    0 讨论(0)
  • 2020-12-16 21:13

    change the icon drawable-hdpi some time icon crashed using any other icon same name problem solved

    Click Open file encoding setting -> project encoding ->cnaged UTf-8

    0 讨论(0)
  • 2020-12-16 21:21

    I had same issue , I fix it by adding xmlns:tools="http://schemas.android.com/tools" to the top of mainfest file , and add tools:replace="android:icon" to application tag.

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"  // add tools line here 
        package="yourpackage">
    
    
        <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:supportsRtl="true"
            android:theme="@style/AppTheme"
            tools:replace="android:icon"> //add this line 
    
    .....
    
    </application>
    
    </manifest>
    
    0 讨论(0)
  • 2020-12-16 21:21

    I had the same issue, add

    tools:replace="android:icon,android:theme"

    to application tag

     <?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="co.darkwing.bookingapp" >
            <application
                android:allowBackup="true"
                android:icon="@mipmap/ic_launcher"
                android:label="@string/app_name"
                android:theme="@style/AppTheme_darkwing_co"
                tools:replace="android:icon,android:theme"> //ADD THIS BIT
                <activity
                    android:name=".MainActivity"
                    android:label="@string/app_name" >
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN" />
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
                </activity>
            </application>
        </manifest>
    
    0 讨论(0)
提交回复
热议问题