我的是非三星设备,为了使用Gear Fit的App Connect功能,反编译修改了App,回编译后安装,出现了java.lang.VerifyError,LogCat信息如下:
04-10 17:04:10.619 23832 23832 D AndroidRuntime Shutting down VM
04-10 17:04:10.620 23832 23832 E AndroidRuntime FATAL EXCEPTION: main
04-10 17:04:10.620 23832 23832 E AndroidRuntime Process: com.openapp.gearfitcalculator, PID: 23832
04-10 17:04:10.620 23832 23832 E AndroidRuntime java.lang.VerifyError: Rejecting class com.samsung.android.sdk.cup.Scup because it failed compile-time verification (declaration of 'com.samsung.android.sdk.cup.Scup' appears in /data/app/com.openapp.gearfitcalculator-2/base.apk)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at com.openapp.gearfitcalculator.GearFitRecorderService.onCreate(GearFitRecorderService.java:27)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at android.app.ActivityThread.handleCreateService(ActivityThread.java:2794)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at android.app.ActivityThread.access$1900(ActivityThread.java:154)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1404)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at android.os.Handler.dispatchMessage(Handler.java:102)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at android.os.Looper.loop(Looper.java:135)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at android.app.ActivityThread.main(ActivityThread.java:5294)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at java.lang.reflect.Method.invoke(Native Method)
04-10 17:04:10.620 23832 23832 E AndroidRuntime at java.lang.reflect.Method.invoke(Method.java:372)
这是三星SDK中修改过的部分,Scup.smali
.class public Lcom/samsung/android/sdk/cup/Scup;
.super Ljava/lang/Object;
.source "Scup.java"
# interfaces
.implements Lcom/samsung/android/sdk/SsdkInterface;
# static fields
.field private static final TAG:Ljava/lang/String;
.field private static final VERSION:Ljava/lang/String; = "1.1.0"
.field private static final VERSION_LEVEL:I = 0x2
.field private static final mHashCode:I = -0x4c8716a4
.field private static mIsInitialized:Z
# direct methods
.method static constructor <clinit>()V
.locals 1
.prologue
.line 32
const-class v0, Lcom/samsung/android/sdk/cup/Scup;
invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;
move-result-object v0
sput-object v0, Lcom/samsung/android/sdk/cup/Scup;->TAG:Ljava/lang/String;
.line 36
const/4 v0, 0x0
sput-boolean v0, Lcom/samsung/android/sdk/cup/Scup;->mIsInitialized:Z
.line 38
return-void
.end method
.method public constructor <init>()V
.locals 0
.prologue
.line 43
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 44
return-void
.end method
.method private insertLog(Landroid/content/Context;)V
.locals 10
.param p1, "context" # Landroid/content/Context;
.prologue
.line 101
const/4 v6, -0x1
.line 103
.local v6, "version":I
:try_start_0
invoke-virtual {p1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
move-result-object v7
.line 104
const-string v8, "com.samsung.android.providers.context"
const/16 v9, 0x80
.line 103
invoke-virtual {v7, v8, v9}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;
move-result-object v5
.line 105
.local v5, "pInfo":Landroid/content/pm/PackageInfo;
iget v6, v5, Landroid/content/pm/PackageInfo;->versionCode:I
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
.line 109
.end local v5 # "pInfo":Landroid/content/pm/PackageInfo;
:goto_0
const-string v7, "SM_SDK"
new-instance v8, Ljava/lang/StringBuilder;
const-string v9, "versionCode: "
invoke-direct {v8, v9}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v8, v6}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v8
invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v8
invoke-static {v7, v8}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 110
const/4 v7, 0x1
if-le v6, v7, :cond_0
.line 112
const-string v7, "com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY"
invoke-virtual {p1, v7}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I
move-result v7
.line 111
if-eqz v7, :cond_1
.line 113
new-instance v7, Ljava/lang/SecurityException;
invoke-direct {v7}, Ljava/lang/SecurityException;-><init>()V
throw v7
.line 106
:catch_0
move-exception v3
.line 107
.local v3, "e1":Landroid/content/pm/PackageManager$NameNotFoundException;
const-string v7, "SM_SDK"
const-string v8, "Could not find ContextProvider"
invoke-static {v7, v8}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
goto :goto_0
.line 116
.end local v3 # "e1":Landroid/content/pm/PackageManager$NameNotFoundException;
:cond_0
const-string v7, "SM_SDK"
.line 117
const-string v8, "Add com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY permission"
.line 116
invoke-static {v7, v8}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 138
:goto_1
return-void
.line 121
:cond_1
new-instance v2, Landroid/content/ContentValues;
invoke-direct {v2}, Landroid/content/ContentValues;-><init>()V
.line 123
.local v2, "cv":Landroid/content/ContentValues;
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
move-result-object v7
invoke-virtual {v7}, Ljava/lang/Class;->getPackage()Ljava/lang/Package;
move-result-object v7
invoke-virtual {v7}, Ljava/lang/Package;->getName()Ljava/lang/String;
move-result-object v0
.line 124
.local v0, "appId":Ljava/lang/String;
new-instance v7, Ljava/lang/StringBuilder;
invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;
move-result-object v8
invoke-static {v8}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
move-result-object v8
invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
const-string v8, "#"
invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v7
invoke-virtual {p0}, Lcom/samsung/android/sdk/cup/Scup;->getVersionCode()I
move-result v8
invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v7
invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
.line 126
.local v4, "feature":Ljava/lang/String;
const-string v7, "app_id"
invoke-virtual {v2, v7, v0}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V
.line 127
const-string v7, "feature"
invoke-virtual {v2, v7, v4}, Landroid/content/ContentValues;->put(Ljava/lang/String;Ljava/lang/String;)V
.line 129
new-instance v1, Landroid/content/Intent;
invoke-direct {v1}, Landroid/content/Intent;-><init>()V
.line 132
.local v1, "broadcastIntent":Landroid/content/Intent;
const-string v7, "com.samsung.android.providers.context.log.action.USE_APP_FEATURE_SURVEY"
invoke-virtual {v1, v7}, Landroid/content/Intent;->setAction(Ljava/lang/String;)Landroid/content/Intent;
.line 133
const-string v7, "data"
invoke-virtual {v1, v7, v2}, Landroid/content/Intent;->putExtra(Ljava/lang/String;Landroid/os/Parcelable;)Landroid/content/Intent;
.line 135
const-string v7, "com.samsung.android.providers.context"
invoke-virtual {v1, v7}, Landroid/content/Intent;->setPackage(Ljava/lang/String;)Landroid/content/Intent;
.line 137
invoke-virtual {p1, v1}, Landroid/content/Context;->sendBroadcast(Landroid/content/Intent;)V
goto :goto_1
.end method
.method static isInitialized()Z
.locals 1
.prologue
.line 97
sget-boolean v0, Lcom/samsung/android/sdk/cup/Scup;->mIsInitialized:Z
return v0
.end method
# virtual methods
.method SCUPSDKVERSION1_1_0(I)I
.locals 1
.param p1, "input" # I
.prologue
.line 54
mul-int v0, p1, p1
add-int/2addr v0, p1
return v0
.end method
.method public getVersionCode()I
.locals 1
.prologue
.line 64
const/4 v0, 0x2
return v0
.end method
.method public getVersionName()Ljava/lang/String;
.locals 1
.prologue
.line 74
const-string v0, "1.1.0"
return-object v0
.end method
.method public initialize(Landroid/content/Context;)V
.locals 4
.param p1, "context" # Landroid/content/Context;
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/samsung/android/sdk/SsdkUnsupportedException;
}
.end annotation
.prologue
.line 151
const-string v1, "Scup"
new-instance v2, Ljava/lang/StringBuilder;
const-string v3, "Scup jar version = "
invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual/range {p0 .. p0}, Lcom/samsung/android/sdk/cup/Scup;->getVersionName()Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-static {v1, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 153
if-eqz p1, :cond_0
# test start
:try_start_0
invoke-virtual {p1}, Lcom/samsung/android/sdk/cup/Scup;->insertLog(Landroid/content/Context;)V
const/4 v4, 0x1
sput-boolean v4, Lcom/samsung/android/sdk/cup/Scup;->mIsInitialized:Z
return-void
:try_end_0
.catch Ljava/lang/SecurityException; {:try_start_0 .. :try_end_0} :catch_0
:catch_0
move-exception v1
.line 253
.local v1, "e":Ljava/lang/SecurityException;
new-instance v1, Ljava/lang/SecurityException;
.line 254
const-string v2, "com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY permission is required."
.line 253
invoke-direct {v1, v2}, Ljava/lang/SecurityException;-><init>(Ljava/lang/String;)V
throw v1
# test end
.line 154
:cond_0
new-instance v1, Ljava/lang/IllegalArgumentException;
const-string v2, "context is invalid."
invoke-direct {v1, v2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
throw v1
.end method
.method public isFeatureEnabled(I)Z
.locals 1
.param p1, "type" # I
.prologue
.line 88
const/4 v0, 0x1
return v0
.end method
求助,这个问题怎么解决?如果解决不了就真的只能修改build.prop了。。。