Analysis Failed when handling APK with the old Android support library .
When I use FlowDroid to analyze some older versions of APK files, it ignores all the calls within the onCreate function. The output call graph only contains some simple dummy main methods, and the Jimple file does not include the body of onCreate. Could you please explain why this happens? Below is the simple source code of this APK file.
import android.Manifest;
import android.content.Context;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Context context = getApplicationContext();
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.SEND_SMS}, 1);
SmsManager sms = SmsManager.getDefault();
sms.sendTextMessage("123456", null, "message", null, null);
Toast.makeText(context, "Test!", Toast.LENGTH_LONG).show();
}
}
The body of MainActivity.onCreate should be loaded. If that is not the case, I would need the APK file to debug.
Not having any outgoing callgraph edges for the method calls inside onCreate is expected, though. The Android platform JARs only contain stubs of the Android API methods anyway, so we exclude that code entirely to impove performance. Consequently, the calls in onCreate don't have a callee. Technically they call a phantom method. Keep in mind that the callee in the platform JAR would be useless anyway.
FlowDroid applies summaries to model the effect of API methods on taints.