Mobile
Go to Setting -> Network share -> Turn on USB network sharePC
Configuring the PC that will connect to the network which is provided by Mobile phone. Open your Network Manager via the Network Icon on the Unity Panel.
sudo apt-get update
sudo apt-get install openssh-server
sudo ufw allow 22
sudo apt-get install openssh-client
ssh username@host
Then, we can simply the usage to connect to hostHost workstationHostName 10.70.70.44User darrenlPort 22
ssh workstation
Copy the public key to remote host using ssh-copy-id, thus, we didn't need to type password every timessh-copy-id -i ~/.ssh/id_rsa.pub remote-host
In your build.gradle file, adding the below snipet of code can generate the java doc of your module
configurations { javadocDeps } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile "com.android.support:support-annotations:${rootProject.ext.androidSupportSdkVersion}" javadocDeps "com.android.support:support-annotations:${rootProject.ext.androidSupportSdkVersion}"} task generateJavadocs(type: Javadoc) { source = android.sourceSets.main.java.srcDirs classpath += project.files(android.getBootClasspath() .join(File.pathSeparator)) classpath += configurations.javadocDeps failOnError false destinationDir = file("../javaDoc/") exclude { it.file.path.contains('aidl') } }
$ git clone https://github.com/google/flatbuffers
$ cd flatbuffers
Start to build$ cmake -G "Unix Makefiles"$ cmake -G "Visual Studio 10"$ cmake -G "Xcode"
$ make
After making it, there is one of executable files, called flatc. Now, we can use flatc to genereate different source files for different language using flatbuffers's interface definition language(IDL).$ vi resultcode.fbs
namespace tzutalin.common;Use the below command to generate its c++ header, python, and Java file.enum ResultCode { SUCCESS = 0, TIME_OUT, UNKNOWN_ERROR }
$ ./flatc --cpp --python --java -b resultcode.fbs
ResultCode.py// automatically generated by the FlatBuffers compiler, do not modify#ifndef FLATBUFFERS_GENERATED_RESULTCODE_TZUTALIN_COMMON_H_#define FLATBUFFERS_GENERATED_RESULTCODE_TZUTALIN_COMMON_H_#include "flatbuffers/flatbuffers.h"namespace tzutalin {namespace common {enum ResultCode {ResultCode_SUCCESS = 0,ResultCode_TIME_OUT = 1,ResultCode_UNKNOWN_ERROR = 2,ResultCode_MIN = ResultCode_SUCCESS,ResultCode_MAX = ResultCode_UNKNOWN_ERROR};inline const char **EnumNamesResultCode() {static const char *names[] = { "SUCCESS", "TIME_OUT", "UNKNOWN_ERROR", nullptr };return names;}inline const char *EnumNameResultCode(ResultCode e) { return EnumNamesResultCode()[static_cast<int>(e)]; }} // namespace common} // namespace tzutalin#endif // FLATBUFFERS_GENERATED_RESULTCODE_TZUTALIN_COMMON_H_
# automatically generated by the FlatBuffers compiler, do not modify# namespace: commonclass ResultCode(object):SUCCESS = 0TIME_OUT = 1UNKNOWN_ERROR = 2
// automatically generated by the FlatBuffers compiler, do not modifypackage tzutalin.common;public final class ResultCode {private ResultCode() { }public static final byte SUCCESS = 0;public static final byte TIME_OUT = 1;public static final byte UNKNOWN_ERROR = 2;public static final String[] names = { "SUCCESS", "TIME_OUT", "UNKNOWN_ERROR", };public static String name(int e) { return names[e]; }}
1. $ sudo apt install compizconfig-settings-manager2. $ ccsm3. Enable Ubuntu Unity Plugin. It will ask some questions because enabling it conflicts with another one.
#include <rapidjson/document.h> #include <rapidjson/prettywriter.h> #include <rapidjson/stringbuffer.h> #include <stdio.h> #include <sys/stat.h> using namespace rapidjson; std::stringstream ss_date; time_t t = time(0); struct tm * now = localtime(&t); ss_date << (now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-' << now->tm_mday; StringBuffer s; PrettyWriter<StringBuffer> writer(s); writer.StartObject(); writer.Key("version"); writer.String("1.0"); writer.Key("data"); writer.String(ss_date.str().c_str()); writer.Key("file"); writer.StartArray(); // m_vWriteFilePath is a vector<std::string> which contains 0.mp3 1.mp3 ... for (const auto& path : m_vWriteFilePath) { writer.String(path.c_str()); } writer.EndArray(); writer.EndObject(); std::ofstream of(m_indexFilePath); of << s.GetString(); if (!of.good()) throw std::runtime_error("Can't write the JSON string to the file!");Result:
{ "version": "1.0", "data": "2016-7-20", "file": [ "0.mp3", "1.mp3", "2.mp3", "3.mp3", "4.mp3" ] }
using namespace rapidjson; std::stringstream ss; std::ifstream file(m_indexFilePath); if (file) { ss << file.rdbuf(); file.close(); } else { throw std::runtime_error("!! Unable to open json file"); } Document doc; if (doc.Parse<0>(ss.str().c_str()).HasParseError()) throw std::invalid_argument("json parse error"); // Start parsing json string std::string version = doc["version"].GetString(); std::string date = doc["data"].GetString(); const Value& array = doc["file"]; for (rapidjson::SizeType i = 0; i < array.Size(); i++) { m_vReadFilePath.push_back(array[i].GetString()); }
To initialize with a different maximum value, first stop the Gradle daemon by calling ‘gradlew —-stop’.dexOptions is specifying a maximum number of 2 concurrent dx processes, but the Gradle daemon was initialized with 4.
android { ... dexOptions { jumboMode = true // Eabled it to allow a larger number of strings in the dex files maxProcessCount 1 // The maximum number of concurrent processes that can be used to dex. Defaults to 4. threadCount 1 // Number of threads to use when running dx. Defaults to 4. dexInProcess false //To disable dexing-in-process, add the following code to your module-level build.gradle file: preDexLibraries true // Whether to pre-dex libraries. This can improve incremental builds, but clean builds may be slower. } }
Conversion to Dalvik format failed: Unable to execute dex: method ID not in [0, 0xffff]: 65536
adb disable-verity/enable-verit can only be executed if your ROM is userdebug, and you cannot remount system partition if your image is user build.$ adb root $ adb disable-verity $ adb reboot $ adb wait-for-device $ adb remount