sweet alert dialog 在android studio應用問題說明詳解_Android

來源:互聯網
上載者:User

看到這個sweet-alert-dialog很親切,因為前端開發本人用的提示就是這個js外掛程式,java牛人很厲害,直接弄成一個java包外掛程式,Good!

下面記錄如何引用到工程,並使用:

sweet-alert-dialog外掛程式可以直接到github上下載

地址:https://github.com/pedant/sweet-alert-dialog

或者直接到發布好的頁面下載:

https://github.com/pedant/sweet-alert-dialog/releases

我下載的是:sweet-alert-dialog-1.1版本zip包

將下載sweet-alert-dialog-1.1包解壓出來,再你的app項目中,開啟 File -> New -> Import Module 選擇到剛才解壓的檔案夾



報錯:

Error:Dependency Myalert:sweetalertdialog:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: D:\AndroidStudioProjects\TEST\Myalert\sweetalertdialog\build\outputs\apk\sweetalertdialog-release-unsigned.apk

可以先Build一下sweet-alert-dialog工程。

另外你的工程Gradle Scripts目錄下的bulid.gradle (Module:app)下

dependencies { compile fileTree(include: [‘*.jar'], dir: ‘libs') testCompile ‘junit:junit:4.12' compile ‘com.android.support:appcompat-v7:24.1.1' compile ‘cn.pedant.sweetalert:library:1.3' }

引入:compile ‘cn.pedant.sweetalert:library:1.3'

Build app出現新的錯誤資訊:

Error:Execution failed for task ‘:app:processDebugManifest'.
Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43
is also present at [com.pnikosis:materialish-progress:1.0] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher).
Suggestion: add ‘tools:replace=”android:icon”' to element at AndroidManifest.xml:5:5-18:19 to override.

解決方案:

修改AndroidManifest.xml:

在manifest添加 xmlns:tools=”http://schemas.android.com/tools”

在application添加 tools:replace=”android:icon,android:theme,android:allowBackup,android:label,android:supportsRtl”

將在application中所用到的全部android:都在上面tools:replace=添加進去,逗號分隔。

如下:

<?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="cn.cgrs.myalert"><applicationtools:replace="android:allowBackup,android:icon,android:label,android:supportsRtl,android:theme"android:allowBackup="true"android:icon="@mipmap/ic_launcher"android:label="@string/app_name"android:supportsRtl="true"android:theme="@style/AppTheme"><activity android:name=".MainActivity"><intent-filter><action android:name="android.intent.action.MAIN" /><category android:name="android.intent.category.LAUNCHER" /></intent-filter></activity></application></manifest>

到此sweet-alert-dialog已完成配置,可以開始隨意使用了….

以上所述是小編給大家介紹的sweet alert dialog 在android studio應用問題說明詳解,希望對大家有所協助,如果大家有任何疑問請給我留言,小編會及時回複大家的。在此也非常感謝大家對雲棲社區網站的支援!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.