android 編譯問題

很莫名的出現android HashSet_jni.h錯誤,查了一下基本上鎖定是java版本的問題,嘗試切換java版本無果,參考:http://www.cnblogs.com/rainduck/p/3718227.htmlhtml

卸載java從新安裝仍是同樣。 java

這裏記錄一下重裝jdk1.6的過程python

1. 安裝android

http://www.cnblogs.com/haio/p/7244184.htmlubuntu

2. 配置python2.7

update-alternatives  --install  /usr/bin/java java /usr/local/share/jvm/jdk1.6.0_45/bin/java   1888 jvm

參考:http://blog.csdn.net/xxy0118/article/details/73733136this

 

最後正確答案:spa

I have configed my javap but noting change for this error. My enviornment is (ubuntu15.04, python2.7.6, java1.6.0_45, gcc4.8.2) So I change "external/chromium_org/base/android/jni_generator/jni_generator.py", which remove the error..net

diif as follows: (indent for "def MultipleReplace" is same with "class InlHeaderFileGenerator" )

--- a/base/android/jni_generator/jni_generator.py  
+++ b/base/android/jni_generator/jni_generator.py  
@@ -555,18 +555,24 @@ class JNIFromJavaSource(object):  
                                                                contents)  
     return JNIFromJavaSource(contents, fully_qualified_class)  

+def MultipleReplace(string, rep_dict):  
+    pattern = re.compile("|".join([re.escape(k) for k in rep_dict.keys()]), re.M)  
+    return pattern.sub(lambda x: rep_dict[x.group(0)], string)  

 class InlHeaderFileGenerator(object):  
   """Generates an inline header file for JNI integration."""  

   def __init__(self, namespace, fully_qualified_class, natives,  
                called_by_natives):  
-    self.namespace = namespace  
-    self.fully_qualified_class = fully_qualified_class  
+#    self.namespace = namespace  
+#    self.fully_qualified_class = fully_qualified_class  
+    self.namespace = MultipleReplace(namespace, {'<E>':''})  
+    self.fully_qualified_class = MultipleReplace(fully_qualified_class, {'<E>':''})  
     self.class_name = self.fully_qualified_class.split('/')[-1]  
     self.natives = natives  
     self.called_by_natives = called_by_natives  
-    self.header_guard = fully_qualified_class.replace('/', '_') + '_JNI'  
+#    self.header_guard = fully_qualified_class.replace('/', '_') + '_JNI'  
+    self.header_guard = MultipleReplace(fully_qualified_class, {'/':'_', '<E>':''}) + '_JNI'  

   def GetContent(self):  
     """Returns the content of the JNI binding file."""

https://stackoverflow.com/questions/29631167/error-during-android-platform-compilation-extra-tokens-at-end-of-ifndef-direc

相關文章
相關標籤/搜索