1 使用Android Studio創建一個工程

2 刪除原生工程中Java目錄下系統默認創建的源代碼
3 復制SDK->libs->lib.5plus.base-release.aar文件到原生工程工程的app->libs目錄下
4 打開工程的build.gradle文件
4.1 添加aar文件引用到dependenciesr如下代碼
復制代碼compile(name: 'lib.5plus.base-release', ext: 'aar')
4.2 添加aar文件搜索路徑添到gradle文件,與dependencies同級, 代碼如下
復制代碼repositories { flatDir { dirs 'libs' } }
4.3修改工程的targetSdkVersion大於等於21
4.4 multiDexEnabled設置成false
5 打開工程的Androidmanifest.xml文件,復制以下內容替換該文件中原有application節點下的內容
復制代碼<application android:name="io.dcloud.application.DCloudApplication" android:allowClearUserData="true" android:icon="@drawable/icon" android:label="@string/app_name" android:largeHeap="true" > <activity android:name="io.dcloud.PandoraEntry" android:configChanges="orientation|keyboardHidden|keyboard|navigation" android:label="@string/app_name" android:launchMode="singleTask" android:hardwareAccelerated="true" android:theme="@style/TranslucentTheme" android:screenOrientation="user" android:windowSoftInputMode="adjustResize" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application>
6 在app->src->res->drawble目錄下放應用的圖標文件文件命名為icon.png
7 復制SDK->assets->data目錄和目錄下的文件到工程的src->main->assets目錄下,新創建的工程默認沒有assets目錄,可在與java同級目錄下創建assets目錄
8 Assets目錄下創建apps目錄,復制應用資源到apps目錄下。 注意: 應用資源的路徑為[appid]->www, appid為應用資源manifest.json文件中id節點的值
HBuilderX支持導出本地打包資源,參考:HBilderX生成本地打包App資源
9 修改assets->data->dcloud_control.xml文件的apps->app->appid屬性的值改為當前應用manifest.json文件id節點的值
新版本5+ SDK對功能和資源進行了整合,按照文檔配置好工程后支持大部分的5+API,除OAuth,Share,Push,Statistic,Payment,Speech,Maps等需要使用第三方SDK的5+API,如需使用以上幾個功能則需要針對插件單獨配置文檔鏈接如下