我现在一直在寻找我的答案几个小时,我无法弄明白.请帮忙.
我想要做的是使用Android中的VpnService来获取网络数据包,如应用程序tPacketCapture
我开始使用谷歌的ToyVpn示例代码并对其进行修改,因此我不会将数据发送到服务器.但是,我不确定这是否正确.
我的configure方法在调用establish()之前使用binder.addAddress()的wlan ip地址.我正在使用nexus 7并使用"adb shell netcfg | grep wlan0"来获取地址:
wlan0 UP 192.168.0.6/24 0x00001043 10:bf:48:bf:5f:9d
并在我的方法中添加它:
private void configure() throws Exception {
// If the old interface has exactly the same parameters, use it!
if (mInterface != null) {
Log.i(TAG, "Using the previous interface");
return;
}
// Configure a builder while parsing the parameters.
Builder builder = new Builder();
builder.setMtu(1500);
builder.addAddress("192.168.0.6", 24);
try {
mInterface.close();
} catch (Exception e) {
// ignore
}
mInterface = builder.establish();
}
Run Code Online (Sandbox Code Playgroud)
在调用之后,我调用我修改的run方法来传递String而不是InetSocketAddress,这并不重要,因为我没有在任何地方使用它: …
我试图在Android设备上自动化Android Chrome浏览器(不只是webview或其他浏览器,而是Chrome浏览器).我认为这可以通过以下链接https://sites.google.com/a/chromium.org/chromedriver/getting-started/getting-started---android来实现,但它会自动化我的pc chrome浏览器.
我也试过Appium,但日志后没有任何反应:
debug: executing: adb install C:\Users\hidden\Downloads\AppiumForWindows-0.14.2\
Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk
Run Code Online (Sandbox Code Playgroud)
当我尝试从浏览器访问信息时,我得到了这个:
info: Responding to client with error: {"status":13,"value":{"message":"An unkno
wn server-side error occurred while processing the command.","origValue":"Did no
t successfully proxy server command"},"sessionId":"666c9e4f-7653-487a-b299-959d4
000ca79"}
Run Code Online (Sandbox Code Playgroud)
我的环境变量PATH中有chromedriver.exe,整个日志如下所示:
info: Welcome to Appium v0.14.2
info: Appium REST http interface listener started on 127.0.0.1:5555
info - socket.io started
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"platform":"ANDROID
","app":"chrome","browserName":"android","browserConnectionEnabled":true,"app-pa
ckage":"com.android.chrome","device":"android","rotatable":true,"app-activity":"
com.google.android.apps.chrome.Main","takesScreenshot":true,"version":""}}
info: Looks like we want chrome on android
info: Creating …
Run Code Online (Sandbox Code Playgroud) 有时我安装我的Android应用程序,但我得到以下异常,但这并不总是可重现的.
java.lang.ClassCastException:android.support.v7.widget.ContentFrameLayout无法强制转换为android.support.v7.widget.ContentFrameLayout
我使用multidex在我的Android应用程序,我看这个问题,关于其与multidex实现中的错误三星的设备,但这种情况在运行5.1 LG G3和HTC A9运行6.0.
任何人都有任何想法为什么这是随机发生的,我该怎么做才能解决它?
编辑:我不能分享很多代码,因为这是我工作的公司.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
Run Code Online (Sandbox Code Playgroud)
}
apply plugin:'com.android.application'apply plugin:'com.neenbedankt.android-apt'
buildscript {repositories {mavenCentral()}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
}
Run Code Online (Sandbox Code Playgroud)
}
apply plugin:'com.android.application'apply plugin:'com.neenbedankt.android-apt'
库{mavenCentral()行家{URL ' https://repository-achartengine.forge.cloudbees.com/snapshot '}行家{URL '库-localrepository'}}
android {buildToolsVersion"23.0.2"compileSdkVersion 23
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
minSdkVersion 18
targetSdkVersion 23
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/INDEX.LIST'
}
lintOptions { …
Run Code Online (Sandbox Code Playgroud) 我试图将我们当前的系统从匕首1迁移到2,我被困在这里半天.我不认为我很了解这一点.
这是我的模块:
public class BaseModule {
private final Context context;
private final SharedPreferences rawSharedPreferences;
public BaseModule(
Context context,
@Named("RawPreferences") SharedPreferences rawSharedPreferences
) {
this.context = context;
this.rawSharedPreferences = rawSharedPreferences;
}
@Provides
@Singleton
public Context provideContext() {
return context;
}
@Provides
@Singleton
public DevicePlatform provideDevicePlatform(AndroidDevicePlatform devicePlatform) {
return devicePlatform;
}
@Provides
@Named("RawPreferences")
@Singleton
public SharedPreferences provideRawSharedPreferences() {
return rawSharedPreferences;
}
@Provides
@Named("RawPreferencesStore")
@Singleton
public SharedPreferencesStore provideRawSharedPreferencesStore(
@Named("RawPreferences") SharedPreferences sharedPreferences) {
return new AndroidSharedPreferencesStore(sharedPreferences);
}
Run Code Online (Sandbox Code Playgroud)
我的组件:
@Singleton
@Component(
modules = {BaseModule.class}
) …
Run Code Online (Sandbox Code Playgroud)