Wir portieren eine iOS-Anwendung auf Android und erkunden J2objc und Protobuf. Bis jetzt arbeiten wir an den Problemen (wir sind neu bei Android und einige von ihnen sind aufgrund der Lernkurve).J2Ojbc native Compile-Guava-Header fehlen
Dieses besondere Problem scheint wie ein Fehler in der neuesten Version von j2objc-1.0-2.2. Die # enthält in der übersetzten Zielsetzung c Implementierungsklassen werden nicht in camel case geändert. Hat jemand dieses Verhalten gesehen? Ist das ein Fehler oder eine Einstellung, die wir vermissen?
Danke für Ihre Hilfe.
Hier ist der Fehler Compilation ist:
GcatMobile/shared/build/j2objcSrcGenMain/com/gcatconsult/shared/remote/NetworkBase.m:14:10: fatal error:
'com/google/common/io/BaseEncoding.h' file not found
#include "com/google/common/io/BaseEncoding.h"
Hier sind die #includes in NetworkBase.m, meine übersetzte Implementierungsklasse:
#include "IOSClass.h"
#include "IOSPrimitiveArray.h"
#include "J2ObjC_source.h"
#include "com/gcatconsult/shared/messages/nano/Resp.h"
#include "com/gcatconsult/shared/remote/NetworkBase.h"
#include "com/google/common/io/BaseEncoding.h"
#include "com/google/protobuf/nano/MessageNano.h"
#include "java/io/BufferedInputStream.h"
#include "java/io/ByteArrayOutputStream.h"
#include "java/io/InputStream.h"
#include "java/io/OutputStream.h"
#include "java/io/PrintStream.h"
#include "java/lang/Exception.h"
#include "java/lang/Integer.h"
#include "java/lang/System.h"
#include "java/net/HttpURLConnection.h"
#include "java/net/MalformedURLException.h"
#include "java/net/URL.h"
#include "java/net/URLConnection.h"
#include "java/util/zip/GZIPOutputStream.h"
Hier ist die build.gradle Datei:
plugins {
id 'java'
id "com.github.j2objccontrib.j2objcgradle" version "0.6.0-alpha"
id "com.google.protobuf" version "0.7.5"
}
sourceSets {
main.java.srcDirs += 'src/main/javanano'
}
dependencies {
// Any libraries you depend on, like Guava or JUnit
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.guava:guava:19.0'
compile 'com.google.protobuf.nano:protobuf-javanano:3.0.0-alpha-5'
testCompile 'junit:junit:4.12'
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.0.0-beta-2"
}
generateProtoTasks {
all().each { task ->
task.builtins {
remove java
javanano {
option 'java_multiple_files=true'
option 'ignore_services=true'
}
}
}
}
generatedFilesBaseDir = "$projectDir/src"
}
// Plugin settings; put these at the bottom of the file.
j2objcConfig {
// Sets up libraries you depend on
autoConfigureDeps true
skipJ2objcVerification true
translateClasspaths = ["../../SoftwareDev/NgCalDev/External/j2objc-1.0-2.2/lib/guava-19.0.jar"]
translateArgs '--prefixes', 'src/main/resources/prefixes.properties'
// testMinExpectedTests 0
// Omit these two lines if you don't configure your Xcode project with CocoaPods
// xcodeProjectDir '../../NGCalDev/AuthTouchId' // suggested directory name
// xcodeTargetsIos 'IOS-APP', 'IOS-APPTests' // replace with your iOS targets
finalConfigure() // Must be last call to configuration
}
Wir verwenden J2objc 1.0-2.2, die neueste Version von Xcode: Version 7.3 (7D175) und OS X El Capitan Version 10.11.4
Danke. Das folgende Flag auf der j2objcConfig des Plugins wurde gefunden: extraObjcCompilerArgs + = "-I/Benutzer/Entwickler/SoftwareDev/Extern/j2objc-1.0-2.2/include/guava". Danke für die Hilfe. Jetzt kann ich mit dem Testen der Xcode-Seite beginnen. – Gjchoza