Cordova google-analytics-plugin 导致 phonegap iOS 构建失败

Posted

技术标签:

【中文标题】Cordova google-analytics-plugin 导致 phonegap iOS 构建失败【英文标题】:Cordova google-analytics-plugin causing phonegap iOS build to fail 【发布时间】:2015-11-24 17:24:11 【问题描述】:

我为我的 phonegap 应用程序安装了 cordova google-analytics 插件 (1),它在 android 上运行良好,但它导致我的 ios 构建失败(如果我删除插件,那么我可以再次成功运行 iOS 构建。当我运行 phonegap build ios 时,出现以下错误:

Undefined symbols for architecture i386:                                                                                                                                                                                                                             [115/15414]
  "_deflate", referenced from:
      +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_deflateEnd", referenced from:
      +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_deflateInit2_", referenced from:
      +[GAICompressionUtil gai_dataByCompressingBytes:length:compressionLevel:mode:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_inflate", referenced from:
      +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_inflateEnd", referenced from:
      +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_inflateInit2_", referenced from:
      +[GAICompressionUtil gai_dataByInflatingBytes:length:isRawData:] in libGoogleAnalyticsServices.a(GAICompressionUtil.o)
  "_sqlite3_bind_blob", referenced from:
      -[TAGDataLayerPersistentStoreImpl writeEntriesToDatabase:expireTime:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
  "_sqlite3_bind_double", referenced from:
      -[GAIAnalyticsPropertiesStore bindRecord:toUpsertStatement:] in libGoogleAnalyticsServices.a(GAIAnalyticsPropertiesStore.o)
  "_sqlite3_bind_int", referenced from:
      -[TAGDataLayerPersistentStoreImpl deleteEntries:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
  "_sqlite3_bind_int64", referenced from:
      -[TAGDataLayerPersistentStoreImpl writeEntriesToDatabase:expireTime:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl peekEntryIds:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl deleteEntriesOlderThan:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[GAIAnalyticsPropertiesStore bindRecord:toUpsertStatement:] in libGoogleAnalyticsServices.a(GAIAnalyticsPropertiesStore.o)
  "_sqlite3_bind_text", referenced from:
      -[GAISqlStore tableExists:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[TAGDataLayerPersistentStoreImpl clearKeysWithPrefixSingleThreaded:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl writeEntriesToDatabase:expireTime:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[GAIAnalyticsPropertiesStore bindRecord:toUpsertStatement:] in libGoogleAnalyticsServices.a(GAIAnalyticsPropertiesStore.o)
      -[GAIAnalyticsPropertiesStore selectStmtWithTrackingId:] in libGoogleAnalyticsServices.a(GAIAnalyticsPropertiesStore.o)
  "_sqlite3_close", referenced from:
      -[GAISqlStore closeDatabase] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[TAGDataLayerPersistentStoreImpl closeDatabase] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
  "_sqlite3_column_blob", referenced from:
      -[TAGDataLayerPersistentStoreImpl loadSerialized] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
  "_sqlite3_column_bytes", referenced from:
      -[TAGDataLayerPersistentStoreImpl loadSerialized] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
  "_sqlite3_column_count", referenced from:
      -[GAISqlStore openAndValidateDatabase] in libGoogleAnalyticsServices.a(GAISqlStore.o)
  "_sqlite3_column_double", referenced from:
      -[GAIAnalyticsPropertiesStore propertyRecordForTrackingId:] in libGoogleAnalyticsServices.a(GAIAnalyticsPropertiesStore.o)
  "_sqlite3_column_int", referenced from:
      -[GAISqlStore rowCountForTableWithName:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
  "_sqlite3_column_int64", referenced from:
      -[TAGDataLayerPersistentStoreImpl peekEntryIds:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl numStoredEntries] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[GAIAnalyticsPropertiesStore propertyRecordForTrackingId:] in libGoogleAnalyticsServices.a(GAIAnalyticsPropertiesStore.o)
  "_sqlite3_column_text", referenced from:
      -[GAISqlStore openAndValidateDatabase] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[TAGDataLayerPersistentStoreImpl loadSerialized] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[GAIAnalyticsPropertiesStore hasValidPropertyColumns] in libGoogleAnalyticsServices.a(GAIAnalyticsPropertiesStore.o)
      -[GAIAnalyticsPropertiesStore propertyRecordForTrackingId:] in libGoogleAnalyticsServices.a(GAIAnalyticsPropertiesStore.o)
  "_sqlite3_errcode", referenced from:
      -[TAGDataLayerPersistentStoreImpl prepareSql:description:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
"_sqlite3_errmsg", referenced from:                                                                                                                                                                                                                                 [61/15414]
      -[GAISqlStore errorMessage] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[TAGDataLayerPersistentStoreImpl clearKeysWithPrefixSingleThreaded:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl writeEntriesToDatabase:expireTime:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl deleteEntries:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl numStoredEntries] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl deleteEntriesOlderThan:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl tablePresent:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      ...
  "_sqlite3_finalize", referenced from:
      -[GAISqlStore removeStatementForQuery:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore finalizeAndClearStatements] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore openAndValidateDatabase] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore prepareSql:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore executeSql:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[TAGDataLayerPersistentStoreImpl clearKeysWithPrefixSingleThreaded:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl deleteEntries:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      ...
  "_sqlite3_open", referenced from:
      -[TAGDataLayerPersistentStoreImpl openDatabaseAndInitStatements] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
  "_sqlite3_open_v2", referenced from:
      -[GAISqlStore openAndValidateDatabase] in libGoogleAnalyticsServices.a(GAISqlStore.o)
  "_sqlite3_prepare_v2", referenced from:
      -[GAISqlStore prepareSql:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[TAGDataLayerPersistentStoreImpl prepareSql:description:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
  "_sqlite3_reset", referenced from:
      -[GAISqlStore rowCountForTableWithName:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore tableExists:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore dropTableWithName:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[TAGDataLayerPersistentStoreImpl loadSerialized] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl writeEntriesToDatabase:expireTime:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl peekEntryIds:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentS
toreImpl numStoredEntries] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      ...
  "_sqlite3_step", referenced from:
      -[GAISqlStore rowCountForTableWithName:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore openAndValidateDatabase] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore tableExists:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore dropTableWithName:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[GAISqlStore executeSql:] in libGoogleAnalyticsServices.a(GAISqlStore.o)
      -[TAGDataLayerPersistentStoreImpl clearKeysWithPrefixSingleThreaded:] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      -[TAGDataLayerPersistentStoreImpl loadSerialized] in libGoogleAnalyticsServices.a(TAGDataLayerPersistentStoreImpl.o)
      ...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


** BUILD FAILED **


The following build commands failed:

        Ld build/emulator/Treys.app/Treys normal i386
(1 failure)

Error code 65 for command: xcodebuild with args: -xcconfig,/Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/cordova/build-debug.xcconfig,-project,Treys.xcodeproj,ARCHS=i386,-target,Treys,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_B
UILD_DIR=/Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/build/sharedpch

ERROR building one of the platforms: Error: /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project

Error: /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1008:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1080:5)

我检查了 XCode 项目,libsqlite3.dylib 在框架列表中,并且我在构建设置的链接标志列表中明确添加了-lsqlite3。然后当我尝试在 XCode 中构建它时,我得到一长串几乎相同的错误。下面是截断的一段输出:

duplicate symbol _llvm.embedded.module in:
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGHit.o)
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGTrackingTag.o)
duplicate symbol _llvm.cmdline in:
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGHit.o)
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGUniversalAnalytics.o)
duplicate symbol _llvm.embedded.module in:
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGHit.o)
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGUniversalAnalytics.o)
duplicate symbol _llvm.cmdline in:
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGHit.o)
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGPValueHash.o)
duplicate symbol _llvm.embedded.module in:
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGHit.o)
    /Users/Rylan/cisc/intoli/treys/phonegap/platforms/ios/Treys/Plugins/cordova-plugin-google-analytics/libGoogleAnalyticsServices.a(TAGPValueHash.o)
ld: 230 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

科尔多瓦:5.4.0

电话差距:5.3.6

XCode:6.2

OSX:10.9.5

【问题讨论】:

似乎将框架两次添加到您的 xcode 项目中。 你可以试试github.com/appfeel/analytics-google 我尝试安装 appfeel 插件,但 npf 安装失败。无法安装“cordova-plugin-analytics”:错误:404 未找到:cordova-google-play-services 【参考方案1】:

尝试删除插件,构建 ios,然后读取插件。之后重建 ios 可能会奏效。

如果失败,请尝试删除插件和平台,然后重新添加以重建。

第二个选项对我有用。

【讨论】:

以上是关于Cordova google-analytics-plugin 导致 phonegap iOS 构建失败的主要内容,如果未能解决你的问题,请参考以下文章

google 如何在 Bigquery/Google-Analytics 中设置 fullVisitorId/Client ID?

谷歌分析 - 无法加载资源:http://www.google-analytics.com/ga.js

将谷歌分析跟踪代码限制为一个js

Cordova与现有框架的结合,Cordova插件使用教程,Cordova自定义插件,框架集成Cordova,将Cordova集成到现有框架中

CORDOVA :添加cordova-plugin-file-opener2插件cordova打包报错

cordova的插件怎么引用