2017-05-03 2 views
0

この場合、権限(FINE_LOCATION)のAndroidManifest.xmlを追加/変更したいので、Shoutemのfirebase拡張機能(https://github.com/shoutem/extensions/tree/master/shoutem-firebase)でどのように処理されているか見てみましょう。ShoutemプラットフォームからAndroidManifest.xmlを変更します

プレビューアプリでは、このアプリは既に位置情報などの権限を持っていますが、手動でPlayストアに送信する場合は、この拡張機能を自分の拡張機能に追加する必要があります私のAndroid搭載端末にインストールしてください(私が間違っていた場合は修正してください)。

私はShoutemプラットフォームを使用してのAndroidManifest.xmlを修正するための正しい手順を経るました通報しますか?

アウトカム

ビルドShoutem CLIを使用して成功しますが、フォルダは、Androidデバイス上のインストールに失敗したビルドするCLIは、コピー時にハング

Iやった以下のもの: - のAndroidManifest.xml /アプリで作成します:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.shoutemapp"> 
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
    <application> 
    </application> 
</manifest> 

更新アプリ/ package.json、コメントを追加しました:

, 
"rnpm": { 
    "commands": { 
     "postlink": "node node_modules/[myusername].[extensionname]/scripts/run.js" 
    } 
} 
/scripts/run.jsの

内容:

/* eslint-disable max-len*/ 
'use_strict'; 

const fs = require('fs'); 
const MANIFEST_FILE = 'AndroidManifest.xml'; 

const extensionPath = './node_modules/[myusername].[extensionname]'; 
const manifestFilePath = `${extensionPath}/${MANIFEST_FILE}`; 
const customManifestFileDestination = `android/app/src/customized/${MANIFEST_FILE}`; 

const readStream = fs.createReadStream(manifestFilePath); 
const writeStream = fs.createWriteStream(customManifestFileDestination, { flags: 'a' }); 
readStream.on('error', console.log.bind(null, `Unable to read from ${manifestFilePath}`)); 
writeStream.on('error', console.log.bind(null, `Unable to write to ${customManifestFileDestination}`)); 
writeStream.on('finish', console.log.bind(null, `copied ${manifestFilePath} to ${customManifestFileDestination}`)); 

fs.truncate(customManifestFileDestination, 0, (err) => { 
    if (err) { 
    process.exitCode = 1; 
    throw new Error(`Unable to overwrite, ${manifestFilePath} does not exist`); 
    } 

    console.log(`Overwrite ${customManifestFileDestination} with ${manifestFilePath}`); 
    readStream.pipe(writeStream); 
}); 

I:extensionPathの私username.extensionnameとfirebase拡張として

同じ、:/アンドロイド/ copy_custom_manifestの

require('./android/copy_custom_manifest'); 

コンテンツビルドプロセスでエラーが発生することはありませんが、物理デバイスにはインストールされません。

shoutem build-android

コンソール出力:

BUILD SUCCESSFUL 
Total time: 2 mins 43.478 secs 
This build could be faster, please consider using the Gradle Daemon: https://docs.gradle.org/2.10/userguide/gradle_daemon.html 
Copying .apk to /Users/matthijs/Documents/shoutem/builds 
--> It stops on this last line (copying .apk), no error. 
There was one error however: 
[5/3/2017, 12:06:07 PM] <START> Initializing Packager 
[5/3/2017, 12:06:07 PM] <START> Building in-memory fs for JavaScript 
[5/3/2017, 12:06:07 PM] <END> Building in-memory fs for JavaScript (108ms) 
[5/3/2017, 12:06:07 PM] <START> Building Haste Map 
[5/3/2017, 12:06:07 PM] <END> Building Haste Map (304ms) 
[5/3/2017, 12:06:07 PM] <END> Initializing Packager (473ms) 
platform.buildPlatform(...).finally is not a function 
If you think this error is caused by bug in the shoutem command, you can report the issue here: https://github.com/shoutem/cli/issues 
Make sure to include the information printed using the `shoutem last-error` command 
> @shoutem/[email protected] build /private/var/folders/xp/strzbzt15zz4k1pvmgc99rj40000gn/T/tmp-8209NeOBTGdT1e1B 
> node scripts/build "--platform" "android" "--outputDirectory" "/Users/matthijs/Documents/shoutem/builds" 
Incremental java compilation is an incubating feature. 
:app:preBuild UP-TO-DATE 
:app:preCustomizedReleaseBuild UP-TO-DATE 

答えて

0

これは、@ shoutem/CLIの問題です。新しいバージョンが公開されました(v0.8.143)。この問題を解決しました。 @ shoutem/cliを更新すると、ビルドにエラーが発生するはずです。

CLIはこれだけはい/いいえ更新オプションをご要求されます

$ shoutem -v 

を使用して、それをあなたがそれを使用する次の時間を更新するように求められなければなりません。

アップデートを拒否した場合、あなたが再び求められることはありませんが、あなたは警告されます。

「警告:これはshoutem CLIの古いバージョンである」

そして、あなたは、最新のをインストールすることができますがバージョン:

$ npm install -g @shoutem/cli 
関連する問題